Elasticsearch: Term search not working on special characters

Rose

I am using Elasticsearch latest version 5.6.4. I want to index the special characters and search them for the field title.special. Below is my mappings:

PUT index1
    {
    "mappings": {
          "isContainer:false": {
            "properties": {
              "connectorSpecific": {
                "properties": {

              "title": {
                "type": "text",
                "store": true,
                "fields": {
                  "special":{
                     "type": "text",
                     "analyzer": "special",
                     "search_analyzer": "special"
                }
                }
              }
            }
          }
        },
        "settings": {
          "index": {
            "analysis": {
              "analyzer": {

                  "special": {
                  "filter": [
                    "lowercase"
                  ],
                  "tokenizer": "whitespace"
                }
              }

            }
            }
            }
          }
        }
      }

When I query in Kibana using term query,

GET index1/_search
{
  "query": {
    "term": {
      "title.special": {
        "value": "-unconstrained_net_use_inf_tw"
      }
    }
  }
}

Nothing returns. But when I do a match search, documents do return. for eg.

GET index1/_search
{
  "query": {
    "match": {
      "title.special": {
        "value": "-unconstrained_net_use_inf_tw"
      }
    }
  }
}

Is there something wrong in my mappings? How to make term query work on special characters like *,-,+ etc. Any help is appreciated

Lupanoide

the term query works with the keyword datatype. title.special is a text datatype.to make term query work you have to change your title.special mapping Take a look here, the section called Why doesn’t the term query match my document? https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-term-query.html

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

search with special characters in elasticsearch

Search special characters with elasticsearch

Elasticsearch term query not matching special characters

Using Elasticsearch to search special characters

Azure search not working with special characters #

Django elasticsearch dsl term and phrase search is not working

How to search word with special characters in Kibana - Elasticsearch

how to tokenize and search with special characters in ElasticSearch

Ubuntu terminal grep escape all the special characters in the search term literal

Wordpress search not working with search term exceeding 87 characters

Mysql fulltext search not working with special characters

jQuery DataTables not working special characters results in search

Grep - show the whole line when search found with search term of special characters

Elasticsearch filter term is not working?

elasticsearch how to use exact search and ignore the keyword special characters in keywords?

Escaping special characters in elasticsearch

Elasticsearch replace special characters

Azure Search searching by not full word with special characters is not working

Search in solr with special characters

Customized search with special characters

Search by special characters

Validation for special characters not working

Special characters(á,é..ñ) in Bootsfaces not working

Elastic search term filter is not working

Escape elasticsearch special characters in PHP

Elasticsearch search for Turkish characters

Search string with special characters in mongo

Search for special characters using grep

How to search for special characters in Outlook?