Disabling field analyzing by default in elastic search

后端 未结 3 2092
夕颜
夕颜 2020-12-13 10:17

Is it possible to enable indexing of elastic search fields selectively for a type?

Through the mapping settings for a specific index, one can set the property

3条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-13 10:53

    Ashay code works properly, but as it does not include an index directive the documents will be stored but not indexed, so you will not able to searches or aggregations.

    I suggest include it next way:

    PUT _template/disable_all_analyzer
       {
         "template": "*",
         "mappings": {
           "_default_": {
               "dynamic_templates": [
                   { "notanalyzed": {
                         "match":              "*", 
                         "match_mapping_type": "string",
                         "mapping": {
                             "type":        "keyword",
                             "index":    "not_analyzed"
                         }
                      }
                   }
                 ]
              }
          }
       }
    

提交回复
热议问题