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

[BUG] Query parsing discrepancies lead to runtime failures #574

Open
ohltyler opened this issue Jan 21, 2025 · 1 comment
Open

[BUG] Query parsing discrepancies lead to runtime failures #574

ohltyler opened this issue Jan 21, 2025 · 1 comment
Labels
advanced transform bug Something isn't working v3.0.0 Issues targeting release v3.0.0

Comments

@ohltyler
Copy link
Member

ohltyler commented Jan 21, 2025

There are some discrepancies between some input query, and the final input query received by search request processors at runtime. This is due to the internal query construction done in OpenSearch.

Example:
User writes below query:

{
  "query": {
    "term": {
      "my_field": "my_field_value"
    }
  }
}

which internally gets converted to

{
  "query": {
    "term": {
      "my_field": {
        "value": "my_field_value"  
      }
    }
  }
}

which is read by the processor.

So, writing some transform like query.term.my_field will fail, as it actually needs to be query.term.my_field.value. It will succeed on the UI (since UI only has access to the initial query), but fail at runtime, with something like the following:

Error searching index: [illegal_argument_exception] cannot find field: query.term.my_field in query string: {"query":{"term":{"my_field":{"value":{"my_value"...

There may be other examples / edge cases that can trigger the same unexpected failures. Further investigation is needed on how/when the query gets parsed & transformed. If it is possible to fetch the transformed query on the UI, then we can display it somewhere, and use it as the input JSON to the search request processors to prevent the errors.

If not, at the least, adding some regex checking to proactively provide some dynamic warning messages may help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
advanced transform bug Something isn't working v3.0.0 Issues targeting release v3.0.0
Projects
None yet
Development

No branches or pull requests

1 participant