简体   繁体   中英

Enabling Elasticsearch _size field

I have an index with over 9,000,000 docs.

I have defined my own mapping and everything went fine.

The only problem is that I forgot to enable the _size field and now I need it to localize document with a large size.

From the documentation I found that it's just fine to use the PUT mapping API with these parameters:

{
    "my_index": {
        "_size": {
            "enabled": true
        }
    }
}
  • Does the new mapping will be merged with the one already set?
  • Does the size field will be enabled for already stored documents?

I am a little worried making changes to mapping beacuse the last time that I have updated the settings with a new analyzer the service was having problem due to shard relocation and everything got stuck.

The mappings will be merged OK and the _size field will be enabled for all your documents of type my_index .

Note that if you want to store the _size (in addition to just index its value), you also need to add "store": "yes" in your _size mapping.

Unfortunately, you'll need to re-index your data in order for the _size field to be properly indexed.

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