Issue: search using match_phrase_prefix does not return results for queries which consist of multiple terms, e.g. "Additional HTTP".
ElasticSearch 7.10.2: document is returned when searching "Additional HTTP"
ElasticSearch 7.11.1, 7.11.2, 7.12.1: no documents returned when searching "Additional HTTP"; document is returned when searching "Additional" (single term).
Minimal example:
Create index with custom analyzer:
PUT /test
{
"settings": {
"number_of_shards": 1,
"number_of_replicas" : "0",
"analysis" : {
"analyzer" : {
"custom_analyzer" : {
"filter" : [
"lowercase"
],
"type" : "custom",
"position_increment_gap" : "0",
"tokenizer" : "whitespace"
}
}
}
},
"mappings": {
"dynamic" : "strict",
"date_detection" : false,
"numeric_detection" : false,
"properties": {
"sentences" : {
"dynamic" : "false",
"properties" : {
"text" : {
"type" : "text",
"analyzer" : "custom_analyzer",
"index_prefixes" : {
"min_chars" : 1,
"max_chars" : 10
}
}
}
}
}
}
}
Add a document:
PUT test/_doc/Search-Test#1
{
"sentences" : [
{
"text" : "4/30/2021"
},
{
"text" : "RFC 6585 - Additional HTTP Status Codes"
},
{
"text" : "Internet Engineering Task Force (IETF)"
}
]
}
Perform a search:
GET /test/_search
{
"query": {
"match_phrase_prefix": {
"sentences.text": {
"query": "Additional HTTP"
}
}
}
}
UPD Looks like "index_prefixes" field in index mappings causes query to stop working. If I remove it, search returns results, but I can't imagine why.