Elasticsearch highlight wrong response


(Vcgoyo) #1

ElasticSearch 5.4.0

I have a problem about the highlight

and the searchParse

{
  "from": 0,
  "size": 10,
  "query": {
    "query_string": {
      "query": "name:Cam",
      "fields": [],
      "use_dis_max": true,
      "tie_breaker": 0,
      "default_operator": "or",
      "auto_generate_phrase_queries": false,
      "max_determinized_states": 10000,
      "enable_position_increments": true,
      "fuzziness": "AUTO",
      "fuzzy_prefix_length": 0,
      "fuzzy_max_expansions": 50,
      "phrase_slop": 0,
      "escape": false,
      "split_on_whitespace": true,
      "boost": 1
    }
  },
  "highlight": {
    "pre_tags": [
      "<font color=\"red\">"
    ],
    "post_tags": [
      "</font>"
    ],
    "fields": {
      "name": {
      }
    }
  }
}

and the response

"hits": {
"total": 149538,
"max_score": 5.1039014,
"hits": [
{
"_index": "index-3.2.0",
"_type": "CAMERA_INFO",
"_id": "33010801001310011373",
"_score": 5.1039014,
"_source": {
    .....
   "name": "Camera 16",
    .....
},
"highlight": {
    "name": [
        "<font color="red">C</font><font color="red">a</font><font color="red">m</font>er<font 
        color="red">Camera</font> 16"
   ]
}
}

you can see the response highlight field "name" ,it should be

<font color="red">C</font><font color="red">a</font><font color="red">m</font>era 16

but the result is

<font color="red">C</font><font color="red">a</font><font color="red">m</font>er<font 
        color="red">Camera</font> 16

where is the <font color="red">Camera</font> come from? and where is my "a", why the <font color="red">Camera</font> replace the a


(system) #2

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