I have implemented multifield partial autocomplete using nGram-s as presented in the following blogpost: https://qbox.io/blog/multi-field-partial-word-autocomplete-in-elasticsearch-using-ngrams
It works great in case of a single match query. However, it fails when using the same match query inside a boolean query which contains several other queries as well.
Is there any way to gain the same result as a single match query provides in case of a boolean query?
For instance the match query below works as expected. It retrieves all those documents which contain both "shop" and "mi".
{
"query": {
"match" : {
"_all": {
"query": "shop mi",
"operator": "and"
}
}
}
}
Whereas the boolean query below, which contains the same match query doesn't retrieve any documents. It results in 0 hits. However, it should also retrieve all those documents, which contain both "shop" and "mi", but having values for the "@timestamp" field in the specified range.
{
"query": {
"bool" : {
"must" : [
{
"range" : {
"@timestamp" : {
"from" : 1516881600000,
"to" : 1516882500000,
"include_lower" : true,
"include_upper" : true,
"format" : "epoch_millis",
"boost" : 1.0
}
}
}
],
"filter" : [
{
"match" : {
"_all" : {
"query" : "shop mi",
"operator" : "and",
"boost" : 1.0
}
}
}
],
"boost" : 1.0
}
}
}