The highlight is not returned when using prefixing query

hi all

i am searching by using prefix query, the highlight was return on old version (tested 7.6.2, 7.10.3), but not in latest versions (tested 7.11.0, 7.17.5, 8.10.2, 8.10.4, 8.11.1).
if ""index_prefixes" sub-field is removed, the highlight can be returned correctly in new versions

it looks a bug to me, but i can not find any bug report on it. any idea what's the issue?

here is the setup and data ingestion.

curl  -X PUT 'http://localhost:9200/my_index'  -H 'Content-Type: application/json' -d'   
{
  "settings": {
    "index": {
      "number_of_shards": 1,
      "number_of_replicas": 0 
    }   
  }
}
'

curl   -X PUT "http://localhost:9200/my_index/_mapping?pretty" -H 'Content-Type: application/json' -d'
{
    "properties": {
      "content": {
        "type": "text",
        "index_prefixes": {
          "min_chars" : 2,
          "max_chars" : 5
        }
      }
    }
}
'

  curl  -X PUT "http://localhost:9200/my_index/_doc/1?timeout=5m&pretty" -H 'Content-Type: application/json' -d'
  {
      "content" : "quick brown fox"
  }
  '

here is the query

curl -X GET "http://localhost:9200/my_index/_search?pretty" -H 'Content-Type: application/json' -d'
{
    "from": 0,
    "highlight": {
        "boundary_max_scan": 40,
        "boundary_scanner_locale": "en-US",
        "fields": {
            "content": {
                "type": "plain"
            },
            "content._index_prefix": {
                "type": "plain"
            }
        },
        "fragment_size": 500,
        "number_of_fragments": 5,
        "order": "score"
    },
    "query": {
        "bool": {
            "adjust_pure_negative": true,
            "boost": 1.0,
            "filter": [
                {
                    "ids": {
                        "boost": 1.0,
                        "values": [
                            "1"
                        ]
                    }
                }
            ],
            "must": [
                {
                    "prefix": {
                        "content": {
                            "boost": 1.0,
                            "value": "bro"
                        }
                    }
                }
            ]     
        }
    },
    "size": 10,
    "timeout": "300s"
}
'

in 7.6.2 and 7.10.3, got response

{
  "took" : 197,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 1,
      "relation" : "eq"
    },
    "max_score" : 1.0,
    "hits" : [
      {
        "_index" : "my_index",
        "_type" : "_doc",
        "_id" : "1",
        "_score" : 1.0,
        "_source" : {
          "content" : "quick brown fox"
        },
        "highlight" : {
          "content._index_prefix" : [
            "quick <em>brown</em> fox"
          ]
        }
      }
    ]
  }
}

in new versions, (7.11.0, 7.17.15, 8.10.4, 8.11.1), got

{
  "took" : 102,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 1,
      "relation" : "eq"
    },
    "max_score" : 1.0,
    "hits" : [
      {
        "_index" : "my_index",
        "_type" : "_doc",
        "_id" : "1",
        "_score" : 1.0,
        "_source" : {
          "content" : "quick brown fox"
        }
      }
    ]
  }
}

the highlight section is lost

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.