Hi everyone,
I just started with Elastic Search I wanted to make some items in the query less relevant, so I am trying to give them a negative boost (make the two items in the must_not sub-query less relevant).
And example of my code:
query: {
bool: {
should: [
{
multi_match: {
query: searchQueryString,
fields: ['someType^10', 'someName^4'],
type: 'best_fields',
operator: 'or',
fuzziness: 'AUTO',
},
},
{
multi_match: {
query: searchQueryString,
fields: ['someType^10', 'someName^4'],
type: 'phrase',
operator: 'or',
},
},
],
minimum_should_match: '2',
must_not: [
{
terms: {
type: ['xxxx', 'xxxy'],
},
},
],
negative_boost: 0.5,
},
must: searchCriteria,
},
I've added the type terms xxxx
and xxxy
a negative boost, but the response from Elasticsearch is:
message
:
"x_content_parse_exception"
When the must_not statement is remove, the code can query Elasticsearch, but when I add this the error above is returned.
must_not: [
{
terms: {
type: ['xxxx', 'xxxy'],
},
},
],
negative_boost: 0.5,
},
must: searchCriteria,
},
Did I make a typo of some kind, of is there another way to do this?