Words with - in elastic search

I have string like "DMZ-trust", when I search in elastic it shows result for DMZ and trust but not for complete word "DMZ-trust". Which property defines this behavior in elastic and how to change it.

I am using this mapping and query:

 {
         "mappings": {
            "policy_rule": {
                "properties": {
                    "display_name": {
                        "index": "analyzed", 
                        "type": "text", 
                        "fields": {
                            "_lowercase": {
                                "type": "text", 
                                "analyzer": "case_insensitive"
                            }, 
                            "_raw": {
                                "index": "not_analyzed", 
                                "type": "keyword"
                            }
                        }
                    }
}}}

Query:

{"query":{"bool":{"must":[{"multi_match":{"query":"DMZ-trust","fields":["display_name"],"type":"cross_fields","operator":"or"}}]}}}

Could you provide a full recreation script as described in About the Elasticsearch category. It will help to better understand what you are doing. Please, try to keep the example as simple as possible.

A full reproduction script will help readers to understand, reproduce and if needed fix your problem. It will also most likely help to get a faster answer.

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