Hello Ramy ,
Can you show the mapping ( not just the index creation JSON).
I need to make sure you have applied ngram on the required field.
Thanks
Vineeth
On Wed, Sep 10, 2014 at 1:11 PM, Ramy <[email protected]> wrote:
> 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": [
> "<b>"
> ],
> "post_tags": [
> "</b>"
> ],
> "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": [
> "Konsol*tisch*e",
> "Garten-Ess<b>*tisch*</b>e"
> ],
> "group_name_2_de.autocomplete": [
> "<b>*Tisch*</b>e",
> "Gartentische"
> ]
> }
> },
> {
> "_index": "architonic",
> "_type": "product",
> "_id": "2",
> "_score": 0.88375586,
> "highlight": {
> "group_name_3_de.autocomplete": [
> "Schreib*tisch*e",
> "Ess<b>*tisch*</b>e"
> ],
> "group_name_2_de.autocomplete": [
> "<b>*Tisch*</b>e"
> ]
> }
> },
> {
> "_index": "architonic",
> "_type": "product",
> "_id": "3",
> "_score": 0.88375586,
> "highlight": {
> "group_name_3_de.autocomplete": [
> "Einzel*tisch*e"
> ],
> "group_name_2_de.autocomplete": [
> "Büro<b>*tisch*</b>e"
> ]
> }
> },
> ...
> ]
> }
> }
>
>
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/elasticsearch/e72c34b1-be77-433b-8120-9c3c51af3186%40googlegroups.com
> <https://groups.google.com/d/msgid/elasticsearch/e72c34b1-be77-433b-8120-9c3c51af3186%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/CAGdPd5k%2BJ0oNgF%3DefUcAqZhC6mrZM601DaSYhTggv1xJJGxBKg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.