简体   繁体   中英

Is there a way to update all documents by query in Elasticsearch 1.5?

We made some mistake to put one of the field with accent. So, the field contains é and we would like to update that to e .

We're using Elasticsearch 1.5. Is there a query we can run to update all the documents in one go or do I need to query all the documents and update them all using Elasticsearch lib?

We're using node.js

If you're running ES 1.5, you can install the update-by-query plugin like this:

bin/plugin -install com.yakaz.elasticsearch.plugins/elasticsearch-action-updatebyquery/2.5.1

When done, you can restart your ES server, and run the following query:

curl -XPOST 'localhost:9200/your_index/_update_by_query' -d '{
    "query" : {
        "match_all" : {}
    },
    "script" : "ctx._source.field = 'foo'"
}'

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