<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Anvar Nazar</title>
    <description>The latest articles on DEV Community by Anvar Nazar (@anvarnazar).</description>
    <link>https://dev.to/anvarnazar</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F189248%2Fa83095c1-5229-4a63-b5d6-01ec89e989d7.jpg</url>
      <title>DEV Community: Anvar Nazar</title>
      <link>https://dev.to/anvarnazar</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/anvarnazar"/>
    <language>en</language>
    <item>
      <title>Migrate elastic search indices</title>
      <dc:creator>Anvar Nazar</dc:creator>
      <pubDate>Mon, 03 Oct 2022 07:48:55 +0000</pubDate>
      <link>https://dev.to/anvarnazar/migrate-elastic-search-indices-oa5</link>
      <guid>https://dev.to/anvarnazar/migrate-elastic-search-indices-oa5</guid>
      <description>&lt;p&gt;So you want to migrate Elasticsearch indices from one installation to another. The solution presented here will need Node.js and the package &lt;code&gt;elasticdump&lt;/code&gt; from NPM. You will need to set up these on a system from which you want to do the migrations. Let's start.&lt;/p&gt;

&lt;p&gt;First make sure &lt;a href="https://nodejs.org"&gt;Node.js&lt;/a&gt; is installed.&lt;/p&gt;

&lt;p&gt;Then install &lt;a href="https://www.npmjs.com/package/elasticdump"&gt;elasticdump&lt;/a&gt; by running the command.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm i elasticdump -g&lt;/code&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note: This &lt;code&gt;-g&lt;/code&gt; will install &lt;code&gt;elasticdump&lt;/code&gt; globally. If you got a permission error run with &lt;code&gt;sudo&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Now we can use this package to move an index from one es to another.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;elasticdump \
  --input=http://i1.es.in:9200/index_1 \
  --output=http://i2.es.in:9200/index_1 \
  --type=mapping
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;--input=&lt;/code&gt; arg is the es source instance where you want to move the index from&lt;/p&gt;

&lt;p&gt;&lt;code&gt;--output=&lt;/code&gt; is the destinaation es&lt;/p&gt;

&lt;p&gt;&lt;code&gt;--type=&lt;/code&gt; has three options&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;mapping&lt;/code&gt; if you only want to move index mapping&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;data&lt;/code&gt; if you want to migrate data&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;analyzer&lt;/code&gt; includes analyzer and mapping&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;em&gt;Do this query to list all indices on an elastic instance&lt;/em&gt;&lt;br&gt;
&lt;code&gt;GET _cat/indices?v&lt;/code&gt;&lt;/p&gt;

</description>
      <category>elasticsearch</category>
      <category>opensearch</category>
    </item>
  </channel>
</rss>
