Elasticsearch exclude "stop" words from highlight

386 Views Asked by At

I want to exclude the default stop words from being highlighted but I'm not sure why this isn't working

ES config

"settings": {
    "analysis": {
        "analyzer": {
            "search_synonyms": {
                "tokenizer": "whitespace",
                "filter": [
                    "graph_synonyms",
                    "lowercase",
                    "asciifolding",
                    "stop"
                ],
            }
        },
        "filter": {
            "graph_synonyms": {
                ...
            }
        },
        "normalizer": {
            "normalizer_1": {
                ...
            }
        }
    }
},

Fields mapping:

"mappings": {
    "properties": {
        "description": {
            "type": "text",
            "analyzer": "search_synonyms"
        },
        "narrative": {
            "type":"object",
            "properties":{
                "_all":{
                    "type": "text",
                    "analyzer": "search_synonyms"
                }
            }
        },
        "originator": {
            "type": "keyword",
            "normalizer": "normalizer_1"
        },
        ................
    }
}

Highlight query:

highlight : {
    fields:{
        "*":{}
    }
},

Currently I'm getting stop words such as this, A, IS highlighted within narrative fields and I want to prevent that.

0

There are 0 best solutions below