Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(opensearch): handle index not present errors in search api #4905

Closed
lsampras opened this issue Jun 6, 2024 · 0 comments · Fixed by #4965
Closed

fix(opensearch): handle index not present errors in search api #4905

lsampras opened this issue Jun 6, 2024 · 0 comments · Fixed by #4965
Assignees
Labels

Comments

@lsampras
Copy link
Member

lsampras commented Jun 6, 2024

Currently in the self deployment mode we rely on fluentd to automatically create the index,

in this case when we spin up the local setup the msearch API errors out since the index is not present,
with the following json response

{
  "took": 17,
  "responses": [
    {
      "took": 15,
      "timed_out": false,
      "_shards": {
        "total": 1,
        "successful": 1,
        "skipped": 0,
        "failed": 0
      },
      "hits": {
        "total": {
          "value": 0,
          "relation": "eq"
        },
        "max_score": null,
        "hits": []
      },
      "status": 200
    },
    {
      "took": 12,
      "timed_out": false,
      "_shards": {
        "total": 1,
        "successful": 1,
        "skipped": 0,
        "failed": 0
      },
      "hits": {
        "total": {
          "value": 0,
          "relation": "eq"
        },
        "max_score": null,
        "hits": []
      },
      "status": 200
    },
    {
      "error": {
        "root_cause": [
          {
            "type": "index_not_found_exception",
            "reason": "no such index [hyperswitch-refund-events]",
            "index": "hyperswitch-refund-events",
            "resource.id": "hyperswitch-refund-events",
            "resource.type": "index_or_alias",
            "index_uuid": "_na_"
          }
        ],
        "type": "index_not_found_exception",
        "reason": "no such index [hyperswitch-refund-events]",
        "index": "hyperswitch-refund-events",
        "resource.id": "hyperswitch-refund-events",
        "resource.type": "index_or_alias",
        "index_uuid": "_na_"
      },
      "status": 404
    },
    {
      "error": {
        "root_cause": [
          {
            "type": "index_not_found_exception",
            "reason": "no such index [hyperswitch-dispute-events]",
            "index": "hyperswitch-dispute-events",
            "resource.id": "hyperswitch-dispute-events",
            "resource.type": "index_or_alias",
            "index_uuid": "_na_"
          }
        ],
        "type": "index_not_found_exception",
        "reason": "no such index [hyperswitch-dispute-events]",
        "index": "hyperswitch-dispute-events",
        "resource.id": "hyperswitch-dispute-events",
        "resource.type": "index_or_alias",
        "index_uuid": "_na_"
      },
      "status": 404
    }
  ]
}

In this case it would be better if we treat missing index as 0 hits and log the corresponding errors.

@lsampras lsampras added A-framework Area: Framework A-Analytics labels Jun 6, 2024
@lsampras lsampras changed the title fix(opensearch): Handle index not present errors fix(opensearch): handle index not present errors in search api Jun 6, 2024
@tsdk02 tsdk02 linked a pull request Jun 12, 2024 that will close this issue
14 tasks
@tsdk02 tsdk02 self-assigned this Jun 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants