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

Request parsing of terms query not working as expected #830

Closed
reijnden opened this issue Mar 22, 2024 · 3 comments · Fixed by #833
Closed

Request parsing of terms query not working as expected #830

reijnden opened this issue Mar 22, 2024 · 3 comments · Fixed by #833
Assignees
Labels

Comments

@reijnden
Copy link

reijnden commented Mar 22, 2024

In our project we try to parse a search request with the typedAPI as follows

request, err := search.NewRequest().FromJSON(jsonstr) if err != nil { log.Errorf("failed to create request 1: " + err.Error()) return nil, err }
When we send a bool query with filter on terms, the terms part is being ignored. For example this query

{ "query": { "bool": { "filter": [ { "terms": { "Fields.lcf": [ "bifd", "xxx" ] } } ], "must": { "multi_match": { "query": "possibility", "fields": [ "Text", "Title^3" ] } } } } }

The resulting request does not hold the full terms section. It will be
terms: {}

Now if I change the input query as below it works, but this is obviously not a valid query to send to Elastic

{ "query": { "bool": { "filter": [ { "terms": { "TermsQuery": { "Fields.lcf": [ "bifd", "xxx" ] } } } ], "must": { "multi_match": { "query": "possibility", "fields": [ "Text", "Title^3" ] } } } } }

Am i missing something or is the API buggy here?

Thanks

@reijnden
Copy link
Author

I am attaching a small program that illustrates the issue:
test.tgz

@reijnden reijnden changed the title Request parsing of terms query seems of Request parsing of terms query not working as expected Mar 22, 2024
@Anaethelion Anaethelion self-assigned this Mar 22, 2024
@Anaethelion
Copy link
Contributor

Thank you for reporting this!

This is indeed a bug in the deserialization logic where AdditionalProperty should be handled like AdditionalProperties and seems not to be.

I've got a fix in the works, I'll update this issue once I've tested this further.

@reijnden
Copy link
Author

Sure, you're welcome. Anything I can do let me know.

Anaethelion added a commit that referenced this issue Mar 25, 2024
Anaethelion added a commit that referenced this issue Mar 25, 2024
Anaethelion added a commit that referenced this issue Mar 25, 2024
Anaethelion added a commit that referenced this issue Mar 25, 2024
mdelapenya added a commit to mdelapenya/go-elasticsearch that referenced this issue Apr 24, 2024
* main:
  adding changelog for 8.13.1 (elastic#847)
  Add put_synonym_rule fix (elastic#843)
  add PoolCompressor option and pass it to elastictransport.Config (elastic#840)
  adding changelog for 8.13.0 (elastic#838)
  Bump elastictransport to v8.5.0 (elastic#835)
  Fixes elastic#830 (elastic#833)
  Update apis for 8.14 (elastic#831)
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