简体   繁体   中英

Updating analyzer within ElasticSearch settings

I'm using Sense (Chrome plugin) and I've managed to setup an analyzer and it is working correctly. If I issue a GET (/media/_settings) on the settings the following is returned.

{
   "media": {
      "settings": {
         "index": {
            "creation_date": "1424971612982",
            "analysis": {
               "analyzer": {
                  "folding": {
                     "filter": [
                        "lowercase",
                        "asciifolding"
                     ],
                     "tokenizer": "standard"
                  }
               }
            },
            "number_of_shards": "5",
            "uuid": "ks98Z6YCQzKj-ng0hU7U4w",
            "version": {
               "created": "1040499"
            },
            "number_of_replicas": "1"
         }
      }
   }
}

I am trying to update it by doing the following:

Closing the index

Issuing this PUT command (removing a filter)

PUT /media/_settings
{
  "settings": {
    "analysis": {
      "analyzer": {
        "folding": {
          "tokenizer": "standard",
          "filter":  [ "lowercase" ]
        }
      }
    }
  }
}

Opening the index

But when the settings come back, the filter is not removed. Can you not update an analyzer once you've created it?

Short answer: No.

Longer answer. From the ES docs:

"Although you can add new types to an index, or add new fields to a type, you can't add new analyzers or make changes to existing fields. If you were to do so, the data that had already been indexed would be incorrect and your searches would no longer work as expected."

Best way is to create a new index, and move your data. Some clients have helpers to do this for you, but it's not part of the standard Java client.

http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/reindex.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM