Reputation: 2797
According to docs https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-match-bool-prefix-query.html match_bool_prefix
is equivalent to
{
"query": {
"bool" : {
"should": [
{ "term": { "message": "quick" }},
{ "term": { "message": "brown" }},
{ "prefix": { "message": "f"}}
]
}
}
}
Is there an equivalent query that is equivalent to
{
"query": {
"bool" : {
"must": [
{ "term": { "message": "quick" }},
{ "term": { "message": "brown" }},
{ "prefix": { "message": "f"}}
]
}
}
}
Upvotes: 0
Views: 2805
Reputation: 2547
Edit based on comment:
You can impose an AND condition on the match_bool_prefix query by setting the operator
parameter as follows:
{
"query": {
"match_bool_prefix": {
"message": {
"query": "quick brown f",
"operator": "and"
}
}
}
}
Note that this is not exactly equivalent to the bool > must query in your example, because that query requires an exact match (term
query) of two different values for the same field (message
, in your case).
Upvotes: 2