Skip to content

Request parsing of terms query not working as expected #830

@reijnden

Description

@reijnden

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

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions