Highlight works not always!


(Ramy) #1

Can someone tell me, why the highlighting works not always? what is my
mistake?

This is my mapping:

curl -XPUT "http://localhost:9200/my_index" -d'
{
"settings": {
"analysis": {
"analyzer": {
"autocomplete": {
"type": "custom",
"tokenizer": "ngram_tokenizer",
"filter": [ "lowercase" ]
}
},
"tokenizer": {
"ngram_tokenizer": {
"type": "ngram",
"min_gram": 1,
"max_gram": 20,
"token_chars": ["letter", "digit"]
}
}
}
},
...
}'

and here is my query:

curl -XGET "http://localhost:9200/my_index/my_type/_search" -d'
{
"_source": false,
"size": 5,
"query": {
"multi_match": {
"query": "tisch",
"fields": [
"_de.autocomplete"
],
"operator": "and"
}
},
"highlight": {
"pre_tags": [
""
],
"post_tags": [
"
"
],
"fields": {
"
_de.autocomplete": {}
}
}
}'

and this is my result:

{
"took": 220,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 3649,
"max_score": 0.88375586,
"hits": [
{
"_index": "my_index",
"_type": "my_type",
"_id": "1",
"_score": 0.88375586,
"highlight": {
"group_name_3_de.autocomplete": [
"Konsoltische",
"Garten-Esstische"
],
"group_name_2_de.autocomplete": [
"Tische",
"Gartentische"
]
}
},
{
"_index": "my_index",
"_type": "my_type",
"_id": "2",
"_score": 0.88375586,
"highlight": {
"group_name_3_de.autocomplete": [
"Schreibtische",
"Esstische"
],
"group_name_2_de.autocomplete": [
"Tische"
]
}
},
{
"_index": "my_index",
"_type": "my_type",
"_id": "3",
"_score": 0.88375586,
"highlight": {
"group_name_3_de.autocomplete": [
"Einzeltische"
],
"group_name_2_de.autocomplete": [
"Bürotische"
]
}
},
...
]
}
}

As you can see. Elasticsearch was able to highlight some words. I marked
them as pink and the other are marked as red

Where is the failure?

Thank you

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/ce7b0413-f113-4819-bd24-0499488b7ecf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(system) #2