I have a field that looks like this: "Address": "3478 GLAMORGAN RD". Using Elasticsearch 2.3.1
When using the match_phrase_prefix query on the _all field with a single term, nothing will be returned
Example:
{
"match_phrase_prefix":{
"_all": "glamor"
}
}
Using the profile=true option I can see that this is generating the following Lucene query:
{
"query_type":"TermQuery",
"lucene":"_all:glamor",
...
}
Of course this does not match anything because there is no term "glamor".
When using the match_phrase_prefix query on the Address field with a single term, the expected results are returned.
Example:
{
"match_phrase_prefix":{
"Address": "gl"
}
}
Using the profile=true option I can see that this is generating the following Lucene query:
{
"query_type":"BooleanQuery",
"lucene":"attributes.Address:glenelg attributes.Address:glynnwood attributes.Address:glamorgan",
...
"children":[
{
"query_type":"TermQuery",
"lucene":"attributes.Address:glenelg",
...
},
{
"query_type":"TermQuery",
"lucene":"attributes.Address:glynnwood",
...
},
{
"query_type":"TermQuery",
"lucene":"attributes.Address:glamorgan",
...
}
]
}
I have tried increasing the max expansion parameter, but this did not help. The query on the _all field will work just fine when using more than one term.
Example:
{
"match_phrase_prefix":{
"_all": "3478 glamor"
}
}
Any idea why a single term cannot be used to prefix match when using the _all field?