<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Etchim on Medium]]></title>
        <description><![CDATA[Stories by Etchim on Medium]]></description>
        <link>https://medium.com/@etchim?source=rss-550cb5e4405e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*3qKtn26AwlIwn9TY1TJxXA.png</url>
            <title>Stories by Etchim on Medium</title>
            <link>https://medium.com/@etchim?source=rss-550cb5e4405e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 03:07:35 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@etchim/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Small Tip: Updating a field in an entire index on Elasticsearch]]></title>
            <link>https://etchim.medium.com/small-tip-updating-a-field-in-an-entire-index-on-elasticsearch-b97b4dce6d44?source=rss-550cb5e4405e------2</link>
            <guid isPermaLink="false">https://medium.com/p/b97b4dce6d44</guid>
            <category><![CDATA[rest-api]]></category>
            <category><![CDATA[elasticsearch]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Etchim]]></dc:creator>
            <pubDate>Wed, 13 Jan 2021 11:11:10 GMT</pubDate>
            <atom:updated>2021-01-13T11:11:10.704Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*I3Jlt_63q1bPh-r4nuTkGw.png" /></figure><h3>Quick Tip: Updating a field in an entire index on Elasticsearch</h3><p>Today I was looking at some of the data we store on elastic for addresses and I realised that a particular field had become out of sync as there was an entire refresh on our relational db - resetting most of the values on it. Instead of reindexing the entire database I wondered if I could bulk update the field back to a base value.</p><p>Enter <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update-by-query.html">Update By Query (_update_by_query)</a> API. This API is robust so I recommend you read through the doco to get a better idea of whats happening. For my purpose all I had to do was create an <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/pipeline.html">elastic pipeline</a> with a processor which sets the value of a particular field to its default value of <em>false</em>. In the example below, I wanted to set a visit field to false for all addresses.</p><pre>PUT _ingest/pipeline/set-visit-false<br>{<br> “description” : “sets visit field to false on the addresses”,<br> “processors” : [ {<br>    “set” : {<br>      “field”: “visit”,<br>      “value”: false<br>    }<br> } ]<br>}</pre><p>It is possible to run a conditional statement on the processor setting , see the <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/ingest-processors.html">documentation</a> for examples of it. After creating your pipeline, all you will need to do is run a post to _update_by_query on your index.</p><pre>POST obviousfakeExample/_update_by_query?pipeline=set-visit-false</pre><p>If you have a large index, remember to use <strong><em>wait_for_completion=false</em></strong><em> </em>in your request to run the query asynchronously. Once the update by query is run, elastic will use your pipeline to bulk update the entire indexes visit field to the value false.</p><p>As always the <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html">elastic documentation</a> is the best place to get more information on anything elastic related.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b97b4dce6d44" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>