Elasticsearch: combine cutoff_frequency with the and operator? -
i have come across elasticsearch queries combining cutoff_frequency "and" operator, not make sense me.
this part of bool query:
{ "match": { "content": { "query": "i has candy , cake", "cutoff_frequency": 0.001, "operator": "and" } } }
and according documentation cutoff_frequency (depending on documents, likely) transform following;
{ "bool": { "must": { "bool": { "should": [ { "term": { "text": "candy" }}, { "term": { "text": "cake" }} ] } }, "should": { "bool": { "should": [ { "term": { "text": "i" }}, { "term": { "text": "has" }}, { "term": { "text": "and" }} ] } } } }
but happens since there "and" operator added query? mean "cutoff_frequency" has no effect?
it has effect. documentation elastic documentation
the match query supports cutoff_frequency allows specifying absolute or relative document frequency high-frequency terms moved optional subquery , only scored if 1 of low frequency (below cutoff) terms in case of or operator or all of low-frequency terms in case of , operator match.
update: have been mistaken in query
looks that:
{ "bool": { "must": { "bool": { "must": [ { "term": { "text": "candy" }}, { "term": { "text": "cake" }} ] } }, "should": { "bool": { "should": [ { "term": { "text": "i" }}, { "term": { "text": "has" }}, { "term": { "text": "and" }} ] } } } }
and answering question "yes if match both term"
Comments
Post a Comment