"OR" filter with match phrase prefix in Elasticsearch -
i elasticsearch query wherein want or filter
imagine have kind of documents
[ {name : "john doe"}, {name :"jane doe"}, {name:"steve doe"} ]
a query same thing sql query
select * table name 'ja%' or name 'jo%'
right i'm using elasticsearch's match_phrase_prefix i'm quite stuck or.
thanks
you can use bool should
query implementing or
operation. can make use of prefix
query instead of match_phrase_prefix
you've described. anyways, if still find use case match_phrase_prefix
query replace prefix
query in request below match_phrase_prefix
query.
{ "query": { "bool": { "should": [ { "prefix": { "name": { "value": "ja" } } }, { "prefix": { "name": { "value": "jo" } } } ] } } }
Comments
Post a Comment