CINXE.COM
Guide to Elasticdump - Moving and Saving Elasticsearch Indices
<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><link href="//cdn.snigelweb.com" rel="preconnect"/><title>Guide to Elasticdump - Moving and Saving Elasticsearch Indices</title><meta property="og:site_name" content="Stack Abuse"/><meta property="og:type" content="article"/><meta property="og:title" content="Guide to Elasticdump - Moving and Saving Elasticsearch Indices"/><meta property="og:description" content="Elasticdump is a lightweight tool that copies data to and from Elasticsearch indices. In this guide, we'll take a look at how to install and use Elasticdump to make your work with Elasticsearch easier."/><meta property="og:url" content="https://stackabuse.com/guide-to-elasticdump-moving-and-saving-elasticsearch-indices/"/><meta property="article:published_time" content="2021-06-09T05:30:00Z"/><meta property="article:modified_time" content="2023-03-06T18:32:55Z"/><meta property="article:tag" content="unix"/><meta property="article:tag" content="tool"/><meta property="article:tag" content="node"/><meta property="article:publisher" content="https://stackabuse.com"/><meta property="article:author" content="https://datawrangler.in"/><meta name="description" content="Elasticdump is a lightweight tool that copies data to and from Elasticsearch indices. In this guide, we'll take a look at how to install and use Elasticdump to make your work with Elasticsearch easier."/><meta name="twitter:card" content="summary"/><meta name="twitter:title" content="Guide to Elasticdump - Moving and Saving Elasticsearch Indices"/><meta name="twitter:description" content="Elasticdump is a lightweight tool that copies data to and from Elasticsearch indices. In this guide, we'll take a look at how to install and use Elasticdump to make your work with Elasticsearch easier."/><meta name="twitter:url" content="https://stackabuse.com/guide-to-elasticdump-moving-and-saving-elasticsearch-indices/"/><meta name="twitter:site" content="@StackAbuse"/><meta name="twitter:creator" content="@StackAbuse"/><meta name="twitter:label1" content="Written by"/><meta name="twitter:data1" content="Sathiya Sarathi Gunasekaran"/><meta name="twitter:label2" content="Filed under"/><meta name="twitter:data2" content="unix, tool, node"/><script type="application/ld+json">{ "@context": "https://schema.org", "@type": "Article", "publisher": { "@type": "Organization", "name": "Stack Abuse", "logo": { "@type": "ImageObject", "url": "https://stackabuse.com/assets/images/favicon.svg" } }, "headline": "Guide to Elasticdump - Moving and Saving Elasticsearch Indices", "url": "https://stackabuse.com/guide-to-elasticdump-moving-and-saving-elasticsearch-indices/", "image": { "@type": "ImageObject", "url": null }, "description": "Elasticdump is a lightweight tool that copies data to and from Elasticsearch indices. In this guide, we'll take a look at how to install and use Elasticdump to make your work with Elasticsearch easier.", "mainEntityOfPage": { "@type": "WebPage", "@id": "https://stackabuse.com/" }, "dateCreated": "2021-06-08T04:09:05Z", "datePublished": "2021-06-09T05:30:00Z", "dateModified": "2023-03-06T18:32:55Z", "author": { "@type": "Person", "name": "Sathiya Sarathi Gunasekaran", "url": "https://stackabuse.com/author/datawrangl3r/", "sameAs": [ "https://datawrangler.in", "https://twitter.com/@sathyasarathi90" ], "image": { "@type": "ImageObject", "url": "https://s3.stackabuse.com/media/users/0d0cce90086957ab4e853e5b82249458.jpg" } } }</script><link rel="canonical" href="https://stackabuse.com/guide-to-elasticdump-moving-and-saving-elasticsearch-indices/"/><script data-cfasync="false" type="text/javascript"> window.snigelPubConf = { "adengine": { "activeAdUnits": ["top_leaderboard","sidebar1","sidebar2","sidebar3","incontent1","incontent2","incontent3"] } } </script><script data-cfasync="false" async="" src="https://cdn.snigelweb.com/adengine/stackabuse.com/loader.js" type="text/javascript"></script><script async="" src="https://btloader.com/tag?o=5658536637890560&upapi=true"></script><script src="//cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-MML-AM_CHTML" type="text/javascript" defer=""></script><meta name="next-head-count" content="33"/><link href="//fonts.googleapis.com" rel="preconnect"/><link href="//fonts.gstatic.com" rel="preconnect" crossorigin="true"/><link href="//cdnjs.cloudflare.com" rel="preconnect"/><link href="//s3.stackabuse.com" rel="preconnect"/><link href="//googletagmanager.com" rel="dns-prefetch"/><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="HandheldFriendly" content="True"/><link rel="shortcut icon" sizes="any" href="/assets/images/favicon.ico"/><link rel="shortcut icon" type="image/svg+xml" href="/assets/images/favicon.svg"/><link rel="preload" as="style" href="//fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap"/><link rel="preload" as="style" href="//fonts.googleapis.com/css?family=Nunito:400,400i,700,700i&display=swap"/><meta name="referrer" content="no-referrer-when-downgrade"/><link rel="alternate" type="application/rss+xml" title="Stack Abuse" href="https://stackabuse.com/rss/"/><link rel="preload" href="/_next/static/css/9184903490bed3cd.css" as="style"/><link rel="stylesheet" href="/_next/static/css/9184903490bed3cd.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-c67a75d1b6f99dc8.js"></script><script src="/_next/static/chunks/webpack-d4c8322ddb9caf79.js" defer=""></script><script src="/_next/static/chunks/framework-1dabaad0401a053e.js" defer=""></script><script src="/_next/static/chunks/main-7cc54cdcfbd9bea6.js" defer=""></script><script src="/_next/static/chunks/pages/_app-530fa3a28589599c.js" defer=""></script><script src="/_next/static/chunks/c78d26b1-fe043233b220ebfb.js" defer=""></script><script src="/_next/static/chunks/816-dfcc5ef3cff7cadb.js" defer=""></script><script src="/_next/static/chunks/3646-f084444085f451b1.js" defer=""></script><script src="/_next/static/chunks/7329-ea47eb245049fa3f.js" defer=""></script><script src="/_next/static/chunks/2221-aa293f4e0cf5d5c8.js" defer=""></script><script src="/_next/static/chunks/2325-32d98f7a450411f4.js" defer=""></script><script src="/_next/static/chunks/6637-eb860228a6e85a3a.js" defer=""></script><script src="/_next/static/chunks/6359-49f1ffe3cce0d438.js" defer=""></script><script src="/_next/static/chunks/8069-a016d67cff28dd39.js" defer=""></script><script src="/_next/static/chunks/5178-f6e1931ba9546862.js" defer=""></script><script src="/_next/static/chunks/pages/%5Bslug%5D-9cc9b860b57f563a.js" defer=""></script><script src="/_next/static/1739247265773/_buildManifest.js" defer=""></script><script src="/_next/static/1739247265773/_ssgManifest.js" defer=""></script></head><body><div id="__next"><div><nav class="bg-white pb-2 border-b shadow"><div class="mx-8 px-2 sm:px-4 lg:px-8"><div class="flex justify-between h-16"><div class="flex items-center px-2 lg:px-0"><a href="/"><div class="flex-shrink-0 flex items-center"><svg class="h-6 w-full" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 494.36 63"><defs><style>.cls-1{fill:#363636}.cls-2{fill:#f29c80}.cls-3{fill:#b34a28}.cls-4{fill:#f16335}</style></defs><title>SA Logotype</title><g id="Layer_2" data-name="Layer 2"><g id="Layer_1-2" data-name="Layer 1"><path class="cls-1" d="M104.94,27.65q-3.15-1.44-4.65-2.16c-1-.48-2.17-1.12-3.49-1.91A10.35,10.35,0,0,1,94,21.35a3.58,3.58,0,0,1-.82-2.27,4.79,4.79,0,0,1,1.74-3.89,7.6,7.6,0,0,1,5-1.44,16,16,0,0,1,5.61,1.15,27.13,27.13,0,0,1,4.1,1.84c.73.46,1.3.83,1.71,1.12l5.2-10.8-2-1.44A28.63,28.63,0,0,0,108,2.84a29.37,29.37,0,0,0-9-1.4A18.5,18.5,0,0,0,86.2,6.52a16.81,16.81,0,0,0-5.61,13.06,14.64,14.64,0,0,0,2.81,8.61,21.59,21.59,0,0,0,7.93,6.66c.82.43,2.09,1.07,3.8,1.91s2.94,1.46,3.69,1.87a27.75,27.75,0,0,1,2.6,1.65,6.9,6.9,0,0,1,2,2.09,4.57,4.57,0,0,1,.58,2.27q0,5.84-8.14,5.83a14.52,14.52,0,0,1-6.46-1.87,35.41,35.41,0,0,1-5.1-3c-.95-.74-1.71-1.35-2.25-1.83L75.67,55.15l.89.79a19.23,19.23,0,0,0,2.8,2c1.28.77,2.71,1.55,4.31,2.34a26.52,26.52,0,0,0,6,2,33.14,33.14,0,0,0,7.25.79,29.54,29.54,0,0,0,8-1,21.94,21.94,0,0,0,6.74-3.21,14.53,14.53,0,0,0,4.79-6,21.36,21.36,0,0,0,1.74-8.93,13.77,13.77,0,0,0-3.86-9.54A28,28,0,0,0,104.94,27.65Z"></path><path class="cls-1" d="M143.66,50.69a5.8,5.8,0,0,1-1.17.57,3.84,3.84,0,0,1-1.43.29q-2.75,0-2.74-5.11V34.7h7.39V25h-7.39V11.23H126.21V25h-5.06V34.7h5.06V48.89a22.21,22.21,0,0,0,.55,5,16,16,0,0,0,1.81,4.47,9,9,0,0,0,3.73,3.38A12.76,12.76,0,0,0,138.18,63a17.23,17.23,0,0,0,8.9-2.3l-3-10.3Z"></path><path class="cls-1" d="M177.44,28.51A15.41,15.41,0,0,0,166,23.9a15.82,15.82,0,0,0-12.51,5.69,20.47,20.47,0,0,0-4.93,13.9,20.33,20.33,0,0,0,4.93,13.86A15.85,15.85,0,0,0,166,63a14.47,14.47,0,0,0,11.49-5.26h.14v4.18h12V25H177.44Zm-2,21.17a7.68,7.68,0,0,1-5.85,2.45,7.79,7.79,0,0,1-6-2.41,8.74,8.74,0,0,1-2.26-6.23,8.69,8.69,0,0,1,2.36-6.27,8.15,8.15,0,0,1,11.63,0,8.69,8.69,0,0,1,2.36,6.27A8.74,8.74,0,0,1,175.43,49.68Z"></path><path class="cls-1" d="M216.43,34.34a9.4,9.4,0,0,1,5.88,1.73l4.11-8.71-1.16-.86a15,15,0,0,0-4.18-1.73,22.57,22.57,0,0,0-6.43-.87,18.72,18.72,0,0,0-13.57,5.8,18.81,18.81,0,0,0-5.85,13.86,18.52,18.52,0,0,0,5.85,13.72A18.83,18.83,0,0,0,214.65,63a22,22,0,0,0,6.54-.94,20,20,0,0,0,3.89-1.47c.57-.36,1-.66,1.34-.9l-4.11-8.86-.61.43a9.12,9.12,0,0,1-2.16.87,10.87,10.87,0,0,1-3.11.43,7.75,7.75,0,0,1-5.88-2.66,9.22,9.22,0,0,1-2.46-6.48A9.1,9.1,0,0,1,210.55,37,7.72,7.72,0,0,1,216.43,34.34Z"></path><polygon class="cls-1" points="271.43 24.98 255.69 24.98 243.45 37.87 243.45 0 231.34 0 231.34 61.92 243.45 61.92 243.45 47.16 257.47 61.92 273.07 61.92 254.74 42.62 271.43 24.98"></polygon><polygon class="cls-1" points="296.96 2.52 274.18 61.92 288 61.92 302.84 20.88 302.98 20.88 317.82 61.92 331.63 61.92 308.86 2.52 296.96 2.52"></polygon><path class="cls-1" d="M357.42,23.9a15.41,15.41,0,0,0-11.49,4.61V0H333.82V61.92h12V57.74h.14A14.47,14.47,0,0,0,357.42,63a15.88,15.88,0,0,0,12.52-5.65,20.38,20.38,0,0,0,4.92-13.86,20.51,20.51,0,0,0-4.92-13.9A15.86,15.86,0,0,0,357.42,23.9Zm2.33,25.82a7.8,7.8,0,0,1-5.95,2.41A7.65,7.65,0,0,1,348,49.68a8.69,8.69,0,0,1-2.29-6.19A8.64,8.64,0,0,1,348,37.22a7.7,7.7,0,0,1,5.78-2.44,7.78,7.78,0,0,1,5.84,2.44A8.64,8.64,0,0,1,362,43.49,8.78,8.78,0,0,1,359.75,49.72Z"></path><path class="cls-1" d="M405.78,42.55c0,3.65-.53,6.24-1.57,7.78s-2.83,2.3-5.34,2.3-4.29-.77-5.33-2.3S392,46.2,392,42.55V25h-12.1V45.65q0,9.21,4.54,13.28T398.87,63q9.92,0,14.47-4.07t4.55-13.28V25H405.78Z"></path><path class="cls-1" d="M449.11,42.19A20.21,20.21,0,0,0,445.79,40a23.31,23.31,0,0,0-3.69-1.44,8.7,8.7,0,0,1-1-.29c-.44-.14-.74-.25-.93-.32l-.82-.32-.78-.33-.65-.32a2.25,2.25,0,0,1-.58-.4c-.12-.12-.24-.26-.38-.43a1.25,1.25,0,0,1-.27-.54,2.25,2.25,0,0,1-.07-.58,1.82,1.82,0,0,1,.85-1.76,6.53,6.53,0,0,1,2.91-.47,16,16,0,0,1,7.8,2.31l4-8.36-1.43-.72a22.21,22.21,0,0,0-4.38-1.44,24.9,24.9,0,0,0-5.95-.72q-7,0-11.18,3.14a10.32,10.32,0,0,0-4.14,8.74,9.07,9.07,0,0,0,1.91,6,18.12,18.12,0,0,0,5.2,4.06,28.82,28.82,0,0,0,3.59,1.59A14.8,14.8,0,0,1,439,49a2.2,2.2,0,0,1,1,1.9c0,1.78-1.26,2.67-3.76,2.67a9.22,9.22,0,0,1-4-1.19A23.33,23.33,0,0,1,429,50.51c-.6-.46-1.08-.85-1.44-1.19L422.61,58l1.5,1.3A17.63,17.63,0,0,0,429,61.78,21,21,0,0,0,436.15,63q16.62,0,16.62-12.6a11.23,11.23,0,0,0-1-4.75A9.24,9.24,0,0,0,449.11,42.19Z"></path><path class="cls-1" d="M494.36,43.49q0-9.43-5.24-14.51T475.55,23.9a18.46,18.46,0,0,0-13.62,5.76,19,19,0,0,0-5.67,13.83,18.9,18.9,0,0,0,5.67,13.79A18.54,18.54,0,0,0,475.55,63q12.72,0,18.19-9.65L485,48.74a13.63,13.63,0,0,1-3.9,3.28,10.84,10.84,0,0,1-4.65.83,8.3,8.3,0,0,1-5.2-1.87q-2.4-1.87-2.4-5.76h25.45A14.91,14.91,0,0,0,494.36,43.49Zm-25.17-5.33a6,6,0,0,1,1.91-4.32,6.77,6.77,0,0,1,4.79-1.66,6.51,6.51,0,0,1,4.48,1.55,7,7,0,0,1,2.15,4.43Z"></path><polygon class="cls-2" points="66.05 19.08 73.15 1.3 57.25 1.3 50.16 19.08 66.05 19.08"></polygon><polygon class="cls-3" points="40.21 43.99 32.99 62.06 48.88 62.06 56.1 43.99 40.21 43.99"></polygon><polygon class="cls-4" points="57.69 40.01 64.46 23.05 48.57 23.05 41.8 40.01 57.69 40.01"></polygon><polygon class="cls-2" points="33.06 19.08 40.16 1.3 24.27 1.3 17.17 19.08 33.06 19.08"></polygon><polygon class="cls-3" points="7.22 43.99 0 62.06 15.89 62.06 23.11 43.99 7.22 43.99"></polygon><polygon class="cls-4" points="24.7 40.01 31.47 23.05 15.58 23.05 8.81 40.01 24.7 40.01"></polygon></g></g></svg></div></a><div class="hidden lg:block lg:ml-6"><div class="hidden lg:ml-6 lg:flex"><a href="/tools/" class="mr-8 inline-flex items-center px-1 pt-1 border-b-2 border-blue-400 text-sm font-medium leading-10 text-gray-500 hover:text-gray-700 focus:outline-none focus:text-gray-700 transition duration-150 ease-in-out">Tools</a><div class="px-1 pt-1 border-b-2 border-green-400 focus:border-gray-300 transition duration-150 ease-in-out"><div class="relative" data-headlessui-state=""><button class="text-gray-500 group rounded-md inline-flex items-center focus:outline-none text-sm font-medium leading-10 text-gray-500 hover:text-gray-700 hover:border-gray-300 focus:outline-none focus:text-gray-700" type="button" aria-expanded="false" data-headlessui-state=""><span>Learn</span><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true" class="text-gray-400 ml-2 h-5 w-5 group-hover:text-gray-500"><path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd"></path></svg></button></div><div hidden="" style="position:fixed;top:1px;left:1px;width:1px;height:0;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0;display:none"></div></div><a href="/about/" class="ml-8 inline-flex items-center px-1 pt-1 border-b-2 border-red-400 text-sm font-medium leading-10 text-gray-500 hover:text-gray-700 focus:outline-none focus:text-gray-700 transition duration-150 ease-in-out">About</a></div></div></div><div class="hidden mt-4 md:flex md:flex-1 md:items-center md:justify-center md:px-2 lg:ml-6 lg:justify-end"><div class="relative w-1/2 text-gray-400 transition duration-200 focus-within:text-gray-600"><div class="absolute inset-y-0 left-0 flex items-center pointer-events-none" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true" class="h-5 w-5 ml-2"><path fill-rule="evenodd" d="M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z" clip-rule="evenodd"></path></svg></div><input id="search-field" class="block w-full h-full pl-10 pr-3 py-3 text-sm border-gray-300 text-gray-900 placeholder-gray-500 rounded transition duration-200 focus:outline-none focus:ring-0 focus:border-gray-400" placeholder="Search" type="text"/></div><div class="hidden ml-6 md:flex items-center"><button class="whitespace-nowrap text-base font-medium text-gray-500 hover:text-gray-900">Sign in</button><button class="ml-6 whitespace-nowrap inline-flex items-center justify-center px-4 py-2 border border-transparent rounded-md shadow-sm text-base font-medium text-white bg-orange-500 hover:bg-orange-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-orange-500">Sign up</button></div></div><div class="flex items-center lg:hidden"><button class="inline-flex items-center justify-center p-2 rounded-md text-gray-400 hover:text-gray-500 hover:bg-gray-100 focus:outline-none focus:bg-gray-100 focus:text-gray-500 transition duration-150 ease-in-out" aria-label="Main menu" aria-expanded="false"><svg class="block h-6 w-6" stroke="currentColor" fill="none" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16"></path></svg><svg class="hidden h-6 w-6" stroke="currentColor" fill="none" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path></svg></button></div></div></div><div class="hidden lg:hidden"><div class="pt-2 pb-3"><a href="/tag/python" class="mt-1 block pl-3 pr-4 py-2 border-l-4 border-transparent text-base font-medium text-gray-600 hover:text-gray-800 hover:bg-gray-50 hover:border-gray-300 focus:outline-none focus:text-gray-800 focus:bg-gray-50 focus:border-gray-300 transition duration-150 ease-in-out">Python</a><a href="/tag/javascript" class="mt-1 block pl-3 pr-4 py-2 border-l-4 border-transparent text-base font-medium text-gray-600 hover:text-gray-800 hover:bg-gray-50 hover:border-gray-300 focus:outline-none focus:text-gray-800 focus:bg-gray-50 focus:border-gray-300 transition duration-150 ease-in-out">JavaScript</a><a href="/tag/java" class="mt-1 block pl-3 pr-4 py-2 border-l-4 border-transparent text-base font-medium text-gray-600 hover:text-gray-800 hover:bg-gray-50 hover:border-gray-300 focus:outline-none focus:text-gray-800 focus:bg-gray-50 focus:border-gray-300 transition duration-150 ease-in-out">Java</a></div></div></nav><main><div class="flex items-stretch min-h-screen"><div class="w-full pb-6"><div class="grid grid-cols-12 gap-4 pt-8 text-gray-50" style="background-color:#404040"><div class="col-span-1"></div><div class="col-span-10"><div class="hidden sm:flex items-center text-sm leading-5 font-medium"><a href="/" class="text-gray-400 hover:text-gray-100 transition duration-150 ease-in-out">Home</a><svg class="flex-shrink-0 mx-2 h-5 w-5 text-gray-500" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z" clip-rule="evenodd"></path></svg><span class="text-gray-400">Articles</span></div><div class="py-2"><h1 class="text-3xl font-bold leading-7 sm:text-4xl sm:leading-9">Guide to Elasticdump - Moving and Saving Elasticsearch Indices</h1><div class="flex items-center mt-4"><div><img class="inline-block h-8 w-8 rounded-full ring-2 ring-gray-200" src="//s3.stackabuse.com/media/users/0d0cce90086957ab4e853e5b82249458.jpg" alt=""/></div><div class="ml-4"><a href="/author/datawrangl3r/" class="text-gray-300 hover:text-gray-100">Sathiya Sarathi Gunasekaran</a></div><div><a href="https://twitter.com/@sathyasarathi90"><svg class="h-6 w-6 ml-2 text-gray-300 hover:text-twitter" fill="currentColor" viewBox="0 0 24 24"><path d="M8.29 20.251c7.547 0 11.675-6.253 11.675-11.675 0-.178 0-.355-.012-.53A8.348 8.348 0 0022 5.92a8.19 8.19 0 01-2.357.646 4.118 4.118 0 001.804-2.27 8.224 8.224 0 01-2.605.996 4.107 4.107 0 00-6.993 3.743 11.65 11.65 0 01-8.457-4.287 4.106 4.106 0 001.27 5.477A4.072 4.072 0 012.8 9.713v.052a4.105 4.105 0 003.292 4.022 4.095 4.095 0 01-1.853.07 4.108 4.108 0 003.834 2.85A8.233 8.233 0 012 18.407a11.616 11.616 0 006.29 1.84"></path></svg></a></div></div></div></div></div><div style="color:#404040"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 65"><path fill="currentColor" fill-opacity="1" d="M0,64L60,53.3C120,43,240,21,360,10.7C480,0,600,0,720,10.7C840,21,960,43,1080,48C1200,53,1320,43,1380,37.3L1440,32L1440,0L1380,0C1320,0,1200,0,1080,0C960,0,840,0,720,0C600,0,480,0,360,0C240,0,120,0,60,0L0,0Z"></path></svg></div><div class="grid grid-cols-1 md:grid-cols-24 mx-2 md:mx-0 md:ml-8 md:gap-8"><div class="hidden md:block lg:col-span-2"></div><div class="col-span-14"><div><div class=" my-4 flex justify-center" style="min-height:90px"><div id="adngin-top_leaderboard-0"></div></div><div class="content"><noscript><style>.lazyload-placeholder { display: none; }</style></noscript><h2 id="introduction">Introduction</h2> <p>Elasticsearch initially began as a custom search engine. These days, it has gone above and beyond that singular role as it's part of <em>log aggregation stacks</em>, <em>security monitoring</em>, and even as a <em>datastore for performing exploratory analysis</em>.</p> <p>Indices in Elasticsearch are where the data is stored, and there are often times when these indices need to be transported from one cluster to another. Perhaps we just need a safe backup before moving data to another cluster or upgrading versions. Elasticdump is a tool that helps in facilitating this backup and restore operation.</p> <blockquote> <p><em>Elasticdump</em> is a tool made to move and save Elasticsearch indices.</p> </blockquote> <p>In this guide, we'll take a look at how to use <em>Elasticdump</em> and how to create and move indices between clusters on your local computer.</p> <div class="alert alert-note"> <div class="flex"> <div class="flex-shrink-0 mr-3"> <img src="/assets/images/icon-information-circle-solid.svg" class="icon" aria-hidden="true"/> </div> <div class="w-full"> <p><strong>Note:</strong> To follow this tutorial, you need to have <a href="/docker-a-high-level-introduction" target="_blank">docker installed</a>, as well as <a href="/how-to-install-node-js-on-ubuntu" target="_blank">NPM</a>.</p> </div> </div> </div> <h2 id="whatiselasticdumpandwhyuseit">What Is Elasticdump, and Why Use It?</h2> <p>Those familiar with Elasticsearch would know of its <em>"Snapshot and Restore"</em> feature to facilitate these operations. Yes, it is indeed a smart feature that helps back up individual indices or an entire cluster. While exploring that option for a small number of indices or clusters, you may find that using the <em>"Snapshot and Restore"</em> feature could be an overkill. This is even more pronounced when there's no system to incrementally take snapshots.</p> <p>This is where Elasticdump can help - it's a lightweight tool that can move and save indices with a remote repository required by Elasticsearch's <em>"Snapshot and Restore"</em>.</p> <div data-nosnippet="" id="ad-snigel-1"><div class=" my-4 flex justify-center" style="min-height:250px"><div id="adngin-incontent1-0"></div></div></div><p>Here's what Elasticdump can do:</p> <ul> <li>Copy the indices from one cluster to the other</li> <li>Dump indices to flat files</li> <li>Back up indices & mappings</li> <li>Restore indices across different versions of Elasticsearch</li> <li>Multielasticdump that comes along with Elasticdump can export multiple indices in parallel</li> </ul> <h2 id="settingupelasticdump">Setting up Elasticdump</h2> <h3 id="installation">Installation</h3> <p>Elasticdump is a Node package and it can be directly downloaded from <a href="https://www.npmjs.com/package/elasticdump" target="_blank" rel="noopener nofollow">NPM</a>. We'll need to have Node.js installed, alongside the Node Package Manager (NPM).</p> <p>Let's go ahead and install them, before downloading Elasticdump:</p> <pre><code class="hljs"><span class="hljs-meta">$</span><span class="bash"> sudo apt install nodejs npm <span class="hljs-comment"># Install Node.js + NPM</span></span> <span class="hljs-meta">$</span><span class="bash"> sudo npm install n -g <span class="hljs-comment"># Install helper package to get latest Node.js + NPM versions</span></span> /usr/local/bin/n -> /usr/local/lib/node_modules/n/bin/n /usr/local/lib └── <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="4a240a7d64786478">[email protected]</a> <span class="hljs-meta">$</span><span class="bash"> sudo n latest <span class="hljs-comment"># Get latest version of NPM</span></span> installing : node-v16.2.0 mkdir : /usr/local/n/versions/node/16.2.0 fetch : https://nodejs.org/dist/v16.2.0/node-v16.2.0-linux-x64.tar.xz installed : v16.2.0 (with npm 7.13.0) Note: the node command changed location and the old location may be remembered in your current shell. old : /usr/bin/node new : /usr/local/bin/node To reset the command location hash either start a new shell or execute PATH="$PATH" <span class="hljs-meta"> $</span><span class="bash"> sudo npm install elasticdump -g <span class="hljs-comment"># Install Elasticdump globally on your local machine</span></span> </code></pre> <p>This installs Elasticdump globally and the installation can be verified using the following command:</p> <pre><code class="hljs"><span class="hljs-meta">$</span><span class="bash"> elasticdump --version</span> 6.71.0 </code></pre> <h3 id="settingupanelasticsearchclusteroptional">Setting Up an Elasticsearch Cluster (Optional)</h3> <p>To test Elasticdump out, you will have to have at least one Elasticsearch cluster with a single node setup. If you have an Elasticsearch cluster running already, <u><a href="#elasticdumpinaction">you may skip this step</a></u>.</p> <p>For others, the following commands will spin up an Elasticsearch container for you. Make sure you have Docker or Docker Desktop installed and running on your machine. You can download your suitable installer from <a href="https://www.docker.com/products/docker-desktop" target="_blank" rel="noopener nofollow">here</a>.</p> <p>Once your Docker server is up and running, let's create a directory, which will contain the volume to hold Elasticsearch's data. If this is not done, Elasticsearch volume would be <em>ephemeral</em> and your data will be lost if the container goes down:</p> <pre><code class="hljs"><span class="hljs-meta">$</span><span class="bash"> mkdir -p data/ES9200</span> <span class="hljs-meta">$</span><span class="bash"> mkdir -p data/ES9400</span> <span class="hljs-meta">$</span><span class="bash"> vol_location=`<span class="hljs-built_in">pwd</span>`</span> </code></pre> <div data-nosnippet="" id="ad-snigel-2"><div class=" my-4 flex justify-center" style="min-height:250px"><div id="adngin-incontent2-0"></div></div></div><p>You can now spin up your Elasticsearch container by keying in the following command:</p> <pre><code class="hljs"><span class="hljs-meta">$</span><span class="bash"> docker run -p 9200:9200 -p 9300:9300 -e <span class="hljs-string">"discovery.type=single-node"</span> -v <span class="hljs-variable">${vol_location}</span>/data/es9200:/usr/share/elasticsearch/data --name=es_source -d docker.elastic.co/elasticsearch/elasticsearch:7.13.0</span> </code></pre> <p>Let's break this command down a bit.</p> <p>We've commanded Docker to publish (<code>-p</code> flag) port <code>9200</code> on your host machine to the <code>9200</code> port on your container, and the same process is then run for <code>9300</code>. We have also assigned an environment variable (<code>-e</code> flag) stating that it is going to be a single node setup.</p> <p>Then, we attach the volume (<code>-v</code> flag) to the directory created in the previous setup, mapped to the data directory inside the container, in which the data will be stored.</p> <p>Finally, the <code>--name</code> flag is to give a nice name to the container while the <code>-d</code> flag is to make the container run in the background, and <code>docker.elastic.co/elasticsearch/elasticsearch:7.13.0</code> is the name of the image.</p> <p>We'll copy data from this Elasticsearch cluster to another cluster, using Elasticdump. To make this happen, you can create another cluster known as <code>es_target</code> by issuing the following command:</p> <pre><code class="hljs"><span class="hljs-meta">$</span><span class="bash"> docker run -p 9400:9200 -p 9500:9300 -e <span class="hljs-string">"discovery.type=single-node"</span> -v <span class="hljs-variable">${vol_location}</span>/data/es9400:/usr/share/elasticsearch/data --name=es_target -d docker.elastic.co/elasticsearch/elasticsearch:7.13.0</span> </code></pre> <p><strong>Note:</strong> The service won't run on a port that's already being used by another service.</p> <div data-nosnippet="" id="ad-lead-magnet"><div class="mx-auto pt-3 pb-4 mb-4 lg:mb-2 lg:pt-4 lg:pb-5"><div class="bg-gray-100 px-4 py-1 rounded-lg shadow-lg border border-gray-400 md:py-2 md:px-6 lg:py-3 lg:px-8 flex items-center flex-col xl:flex-row"><div class="xl:pt-2 w-1/2 xs:w-full sm:mx-auto"><div class="lazyload-wrapper "><div style="height:300px" class="lazyload-placeholder"></div></div></div><div class="mt-2 w-full sm:max-w-xl xl:mt-0 xl:ml-8 sm:w-2/3 sm:mx-auto sm:text-center"><span class="mt-2 mb-1 text-xl leading-4 font-extrabold tracking-tight text-gray-600 sm:text-2xl sm:leading-6">Free eBook: Git Essentials</span><p class="mt-3 max-w-3xl text-md leading-6 text-gray-500">Check out our hands-on, practical guide to learning Git, with best-practices, industry-accepted standards, and included cheat sheet. Stop Googling Git commands and actually <em>learn</em> it!</p><div class="mt-4 flex sm:justify-center sm:mx-auto"><div class="ml-3 xl:inline-flex rounded-md shadow"><button class="inline-flex items-center justify-center px-3 py-1 bg-orange-400 border border-transparent text-base leading-6 font-medium rounded-md hover:bg-orange-500 hover:no-underline focus:outline-none focus:ring transition duration-150 ease-in-out"><span class="inline-flex items-center text-white">Download the eBook<!-- --> <svg class="w-4 h-4" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M10.293 3.293a1 1 0 011.414 0l6 6a1 1 0 010 1.414l-6 6a1 1 0 01-1.414-1.414L14.586 11H3a1 1 0 110-2h11.586l-4.293-4.293a1 1 0 010-1.414z" clip-rule="evenodd"></path></svg></span></button></div></div></div></div></div></div><p>You can check if your Elasticsearch cluster containers are running fine by issuing the following command:</p> <pre><code class="hljs"><span class="hljs-meta">$</span><span class="bash"> docker ps</span> CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES c0aa983abb21 docker.elastic.co/elasticsearch/elasticsearch:7.13.0 "/bin/tini -- /usr/l…" 9 hours ago Up 2 hours 0.0.0.0:9400->9200/tcp, :::9400->9200/tcp, 0.0.0.0:9500->9300/tcp, :::9500->9300/tcp es_target eb30714b5302 docker.elastic.co/elasticsearch/elasticsearch:7.13.0 "/bin/tini -- /usr/l…" 10 hours ago Up 3 hours 0.0.0.0:9200->9200/tcp, :::9200->9200/tcp, 0.0.0.0:9300->9300/tcp, :::9300->9300/tcp es_source </code></pre> <p>The containers that you have created look good! Let's dive into the usage of Elasticdump.</p> <h2 id="workingwithelasticdump">Working with Elasticdump</h2> <p>With a container ready, we can start working with Elasticdump.</p> <h3 id="restoringtheindex">Restoring the Index</h3> <p>The clusters are ready, but they look empty. Let's create an index and load data to one of the clusters. The <code>es_source</code> cluster runs on port <code>9200</code> and can be accessed via <code>http://localhost:9200</code>. Run the following commands to download the mapping and the data to be loaded:</p> <pre><code class="hljs"><span class="hljs-meta">$</span><span class="bash"> wget https://raw.githubusercontent.com/StackAbuse/moving-elasticsearch-indices-with-elasticdump/main/logs_mapping.json</span> <span class="hljs-meta">$</span><span class="bash"> wget https://raw.githubusercontent.com/StackAbuse/moving-elasticsearch-indices-with-elasticdump/main/logs_data.json</span> </code></pre> <p>Let's try loading these files to the <code>es_source</code> cluster under the index <code>log-2021-06-01</code> using Elasticdump:</p> <pre><code class="hljs"><span class="hljs-meta">$</span><span class="bash"> elasticdump --input=logs_mapping.json --output=http://localhost:9200/log-2021-06-01 --<span class="hljs-built_in">type</span>=mapping</span> <span class="hljs-meta">$</span><span class="bash"> elasticdump --input=logs_data.json --output=http://localhost:9200/logindex --<span class="hljs-built_in">type</span>=data</span> </code></pre> <p>There are three flags here: <code>--input</code> corresponds to the JSON file that we have downloaded, <code>--output</code> corresponds to the cluster endpoint, and <code>--type</code> corresponds to either mapping or data which defines what to export.</p> <p>Elasticdump takes the input as these files and writes the output to the <code>log-2021-06-01</code> index as:</p> <pre><code class="hljs"><span class="hljs-meta">$</span><span class="bash"> elasticdump --input=logs_mapping.json --output=http://localhost:9200/log-2021-06-01 --<span class="hljs-built_in">type</span>=mapping</span> Sat, 05 Jun 2021 12:30:52 GMT | starting dump Sat, 05 Jun 2021 12:30:52 GMT | got 1 objects from source file (offset: 0) Sat, 05 Jun 2021 12:30:59 GMT | sent 1 objects to destination elasticsearch, wrote 1 Sat, 05 Jun 2021 12:30:59 GMT | got 0 objects from source file (offset: 1) Sat, 05 Jun 2021 12:30:59 GMT | Total Writes: 1 Sat, 05 Jun 2021 12:30:59 GMT | dump complete <span class="hljs-meta"> $</span><span class="bash"> elasticdump --input=logs_data.json --output=http://localhost:9200/log-2021-06-01 --<span class="hljs-built_in">type</span>=data</span> Sat, 05 Jun 2021 12:31:23 GMT | starting dump Sat, 05 Jun 2021 12:31:24 GMT | got 100 objects from source file (offset: 0) Sat, 05 Jun 2021 12:31:26 GMT | sent 100 objects to destination elasticsearch, wrote 100 Sat, 05 Jun 2021 12:31:26 GMT | got 100 objects from source file (offset: 100) Sat, 05 Jun 2021 12:31:27 GMT | sent 100 objects to destination elasticsearch, wrote 100 Sat, 05 Jun 2021 12:31:27 GMT | got 100 objects from source file (offset: 200) Sat, 05 Jun 2021 12:31:28 GMT | sent 100 objects to destination elasticsearch, wrote 100 Sat, 05 Jun 2021 12:31:28 GMT | got 0 objects from source file (offset: 300) Sat, 05 Jun 2021 12:31:28 GMT | got 0 objects from source file (offset: 300) Sat, 05 Jun 2021 12:31:28 GMT | Total Writes: 300 Sat, 05 Jun 2021 12:31:28 GMT | dump complete </code></pre> <div data-nosnippet="" id="ad-snigel-3"><div class=" my-4 flex justify-center" style="min-height:250px"><div id="adngin-incontent3-0"></div></div></div><p>Let's check if the restoration is completed successfully:</p> <pre><code class="hljs"><span class="hljs-meta">$</span><span class="bash"> curl localhost:9200/_cat/indices</span> yellow open log-2021-06-01 UD4SRzu-TjCNdVZatdOQsA 1 1 300 0 305.5kb 305.5kb </code></pre> <p>There are 300 documents in Elasticsearch constituting a total size of <code>305.5kb</code>.</p> <h3 id="copyingtheindexacrossclusters">Copying the Index Across Clusters</h3> <p>The syntax seen above is similar across the usage of Elasticdump for different scenarios. Let's now copy the index created previously into a new index on another cluster:</p> <pre><code class="hljs"><span class="hljs-meta">$</span><span class="bash"> elasticdump --input=http://localhost:9200/log-2021-06-01 --output=http://localhost:9400/log-2021-06-01</span> Sat, 05 Jun 2021 10:05:24 GMT | starting dump Sat, 05 Jun 2021 10:05:24 GMT | got 100 objects from source elasticsearch (offset: 0) Sat, 05 Jun 2021 10:05:28 GMT | sent 100 objects to destination elasticsearch, wrote 100 Sat, 05 Jun 2021 10:05:28 GMT | got 100 objects from source elasticsearch (offset: 100) Sat, 05 Jun 2021 10:05:28 GMT | sent 100 objects to destination elasticsearch, wrote 100 Sat, 05 Jun 2021 10:05:28 GMT | got 100 objects from source elasticsearch (offset: 200) Sat, 05 Jun 2021 10:05:30 GMT | sent 100 objects to destination elasticsearch, wrote 100 Sat, 05 Jun 2021 10:05:30 GMT | got 0 objects from source elasticsearch (offset: 300) Sat, 05 Jun 2021 10:05:30 GMT | Total Writes: 300 Sat, 05 Jun 2021 10:05:30 GMT | dump complete </code></pre> <p>Elasticdump will create a new index for you if the output index doesn't exist. Let's again verify if the index has been created properly.</p> <pre><code class="hljs"><span class="hljs-meta">$</span><span class="bash"> curl localhost:9400/_cat/indices</span> yellow open log-2021-06-01 UD4SRzu-TjCNdVZatdOQsA 1 1 300 0 305.5kb 305.5kb </code></pre> <h2 id="conclusion">Conclusion</h2> <p>As simple as it sounds, the Elasticdump tool is a must-have tool for anyone dealing with Elasticsearch.</p> </div><div class="md:flex md:items-center md:justify-between mt-8 mb-4"><div class=""><a class="inline-flex items-center mr-2 px-2.5 py-0.5 rounded-md text-sm font-medium bg-gray-200 text-gray-700 hover:text-gray-900" href="/tag/unix/"><span class="text-gray-400">#</span> <!-- -->unix</a><a class="inline-flex items-center mr-2 px-2.5 py-0.5 rounded-md text-sm font-medium bg-gray-200 text-gray-700 hover:text-gray-900" href="/tag/tool/"><span class="text-gray-400">#</span> <!-- -->tool</a><a class="inline-flex items-center mr-2 px-2.5 py-0.5 rounded-md text-sm font-medium bg-gray-200 text-gray-700 hover:text-gray-900" href="/tag/node/"><span class="text-gray-400">#</span> <!-- -->node</a></div><div class="inline-flex text-gray-500 text-sm"><div>Last Updated: <!-- -->March 6th, 2023</div></div></div><div class="w-full lg:w-1/3 border-gray-200" style="border-top-width:6px"></div><div class="md:flex md:items-center md:justify-between py-2"><div class="flex items-center text-sm text-gray-500"><span class="mr-2">Was this article helpful?</span><div class="flex justify-center sm:justify-start"><span class="cursor-pointer"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true" class="w-5 h-5"><path stroke-linecap="round" stroke-linejoin="round" d="M11.049 2.927c.3-.921 1.603-.921 1.902 0l1.519 4.674a1 1 0 00.95.69h4.915c.969 0 1.371 1.24.588 1.81l-3.976 2.888a1 1 0 00-.363 1.118l1.518 4.674c.3.922-.755 1.688-1.538 1.118l-3.976-2.888a1 1 0 00-1.176 0l-3.976 2.888c-.783.57-1.838-.197-1.538-1.118l1.518-4.674a1 1 0 00-.363-1.118l-3.976-2.888c-.784-.57-.38-1.81.588-1.81h4.914a1 1 0 00.951-.69l1.519-4.674z"></path></svg></span><span class="cursor-pointer"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true" class="w-5 h-5"><path stroke-linecap="round" stroke-linejoin="round" d="M11.049 2.927c.3-.921 1.603-.921 1.902 0l1.519 4.674a1 1 0 00.95.69h4.915c.969 0 1.371 1.24.588 1.81l-3.976 2.888a1 1 0 00-.363 1.118l1.518 4.674c.3.922-.755 1.688-1.538 1.118l-3.976-2.888a1 1 0 00-1.176 0l-3.976 2.888c-.783.57-1.838-.197-1.538-1.118l1.518-4.674a1 1 0 00-.363-1.118l-3.976-2.888c-.784-.57-.38-1.81.588-1.81h4.914a1 1 0 00.951-.69l1.519-4.674z"></path></svg></span><span class="cursor-pointer"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true" class="w-5 h-5"><path stroke-linecap="round" stroke-linejoin="round" d="M11.049 2.927c.3-.921 1.603-.921 1.902 0l1.519 4.674a1 1 0 00.95.69h4.915c.969 0 1.371 1.24.588 1.81l-3.976 2.888a1 1 0 00-.363 1.118l1.518 4.674c.3.922-.755 1.688-1.538 1.118l-3.976-2.888a1 1 0 00-1.176 0l-3.976 2.888c-.783.57-1.838-.197-1.538-1.118l1.518-4.674a1 1 0 00-.363-1.118l-3.976-2.888c-.784-.57-.38-1.81.588-1.81h4.914a1 1 0 00.951-.69l1.519-4.674z"></path></svg></span><span class="cursor-pointer"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true" class="w-5 h-5"><path stroke-linecap="round" stroke-linejoin="round" d="M11.049 2.927c.3-.921 1.603-.921 1.902 0l1.519 4.674a1 1 0 00.95.69h4.915c.969 0 1.371 1.24.588 1.81l-3.976 2.888a1 1 0 00-.363 1.118l1.518 4.674c.3.922-.755 1.688-1.538 1.118l-3.976-2.888a1 1 0 00-1.176 0l-3.976 2.888c-.783.57-1.838-.197-1.538-1.118l1.518-4.674a1 1 0 00-.363-1.118l-3.976-2.888c-.784-.57-.38-1.81.588-1.81h4.914a1 1 0 00.951-.69l1.519-4.674z"></path></svg></span><span class="cursor-pointer"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true" class="w-5 h-5"><path stroke-linecap="round" stroke-linejoin="round" d="M11.049 2.927c.3-.921 1.603-.921 1.902 0l1.519 4.674a1 1 0 00.95.69h4.915c.969 0 1.371 1.24.588 1.81l-3.976 2.888a1 1 0 00-.363 1.118l1.518 4.674c.3.922-.755 1.688-1.538 1.118l-3.976-2.888a1 1 0 00-1.176 0l-3.976 2.888c-.783.57-1.838-.197-1.538-1.118l1.518-4.674a1 1 0 00-.363-1.118l-3.976-2.888c-.784-.57-.38-1.81.588-1.81h4.914a1 1 0 00.951-.69l1.519-4.674z"></path></svg></span></div></div><div class="inline-flex"><a href="https://twitter.com/share?text=Check out Guide to Elasticdump - Moving and Saving Elasticsearch Indices!&amp;url=https://stackabuse.com/guide-to-elasticdump-moving-and-saving-elasticsearch-indices/&amp;via=StackAbuse"><svg class="h-6 w-6 text-gray-500 hover:text-twitter" fill="currentColor" viewBox="0 0 24 24"><path d="M8.29 20.251c7.547 0 11.675-6.253 11.675-11.675 0-.178 0-.355-.012-.53A8.348 8.348 0 0022 5.92a8.19 8.19 0 01-2.357.646 4.118 4.118 0 001.804-2.27 8.224 8.224 0 01-2.605.996 4.107 4.107 0 00-6.993 3.743 11.65 11.65 0 01-8.457-4.287 4.106 4.106 0 001.27 5.477A4.072 4.072 0 012.8 9.713v.052a4.105 4.105 0 003.292 4.022 4.095 4.095 0 01-1.853.07 4.108 4.108 0 003.834 2.85A8.233 8.233 0 012 18.407a11.616 11.616 0 006.29 1.84"></path></svg></a><a href="https://www.facebook.com/sharer/sharer.php?u=https://stackabuse.com/guide-to-elasticdump-moving-and-saving-elasticsearch-indices/"><svg class="h-6 w-6 ml-2 text-gray-500 hover:text-facebook" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M22 12c0-5.523-4.477-10-10-10S2 6.477 2 12c0 4.991 3.657 9.128 8.438 9.878v-6.987h-2.54V12h2.54V9.797c0-2.506 1.492-3.89 3.777-3.89 1.094 0 2.238.195 2.238.195v2.46h-1.26c-1.243 0-1.63.771-1.63 1.562V12h2.773l-.443 2.89h-2.33v6.988C18.343 21.128 22 16.991 22 12z" clip-rule="evenodd"></path></svg></a><a href="/cdn-cgi/l/email-protection#be81cdcbdcd4dbddca83f9cbd7dadb9ecad19efbd2dfcdcad7dddacbd3ce9e939ef3d1c8d7d0d99edfd0da9eeddfc8d7d0d99efbd2dfcdcad7ddcddbdfccddd69ef7d0dad7dddbcd9ec8d7df9eedcadfddd5ffdccbcddb90ddd1d398dfd3ce85dfd3ce85dcd1dac783fdd6dbddd59ed1cbca9ecad6db9edfcccad7ddd2db9ed6cacacecd849191cdcadfddd5dfdccbcddb90ddd1d391d9cbd7dadb93cad193dbd2dfcdcad7dddacbd3ce93d3d1c8d7d0d993dfd0da93cddfc8d7d0d993dbd2dfcdcad7ddcddbdfccddd693d7d0dad7dddbcd919ed1d09eedcadfddd5ffdccbcddb90ddd1d39f"><svg class="h-6 w-6 ml-2 text-gray-500 hover:text-gray-900" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 12a4 4 0 10-8 0 4 4 0 008 0zm0 0v1.5a2.5 2.5 0 005 0V12a9 9 0 10-9 9m4.5-1.206a8.959 8.959 0 01-4.5 1.207"></path></svg></a></div></div></div><div><div class="my-6 sm:mt-12 sm:mb-6"><h3 class="mb-4 text-xl font-semibold leading-6">You might also like...</h3><ul class="text-lg mt-4 ml-4 list-disc space-y-1"><li class="text-orange-500"><a href="/using-spies-for-testing-in-javascript-with-sinon/"><div class="text-gray-700">Using Spies for Testing in JavaScript with Sinon.js</div></a></li><li class="text-orange-500"><a href="/npm-throws-error-without-sudo/"><div class="text-gray-700">NPM Throws Error without Sudo</div></a></li><li class="text-orange-500"><a href="/using-mocks-for-testing-in-javascript-with-sinon-js/"><div class="text-gray-700">Using Mocks for Testing in JavaScript with Sinon.js</div></a></li><li class="text-orange-500"><a href="/using-nvm-to-install-node/"><div class="text-gray-700">Using NVM to Install Node</div></a></li><li class="text-orange-500"><a href="/run-periodic-tasks-in-node-with-node-cron/"><div class="text-gray-700">Run Periodic Tasks in Node with node-cron</div></a></li></ul></div><div><div class="max-w-6xl mx-auto px-0 py-6 lg:py-8"><div class="px-6 py-6 rounded-lg md:py-12 md:px-8 lg:py-16 lg:px-10 xl:flex xl:items-center xl:justify-between grid grid-cols-1 xl:grid-cols-2" style="background-color:#404040"><div class=""><h2 class="text-2xl font-extrabold tracking-tight text-white sm:text-3xl">Improve your dev skills!</h2><p class="mt-3 max-w-3xl text-lg leading-6 text-gray-200">Get tutorials, guides, and dev jobs in your inbox.</p></div><div class="mt-8 sm:w-full sm:max-w-md xl:mt-0 xl:ml-8"><form class="sm:flex"><label for="email-address" class="sr-only">Email address</label><input id="email-address" type="email" autoComplete="email" required="" class="w-full border-white px-3 py-3 placeholder-gray-500 focus:outline-none focus:ring-1 focus:ring-offset-1 focus:ring-offset-gray-500 focus:ring-white rounded-md" placeholder="Enter your email" value=""/><button type="submit" class="mt-3 w-full flex items-center justify-center px-5 py-3 border border-transparent shadow text-base font-medium rounded-md text-white hover:bg-orange-400 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-orange-700 focus:ring-white sm:mt-0 sm:ml-3 sm:w-auto sm:flex-shrink-0" style="background-color:#f16334">Sign Up</button></form><p class="mt-3 text-sm text-gray-300">No spam ever. Unsubscribe at any time. Read our<!-- --> <a class="font-medium underline" href="/privacy-policy/"><span class="text-gray-400">Privacy Policy.</span></a></p></div></div></div></div><div class="flex content-start flex-wrap"><div class="mt-12"><div class="flex items-center"><div class="flex-shrink-0"><a href="/author/datawrangl3r/"><div class="lazyload-wrapper "><div style="height:5rem" class="lazyload-placeholder"></div></div></a></div><div class="ml-3"><a href="/author/datawrangl3r/" class="font-medium text-lg leading-6"><span class="text-gray-900">Sathiya Sarathi Gunasekaran</span></a><span class="ml-2 text-sm leading-5 text-gray-500 italic">Author</span><div class="flex content-start flex-wrap"><a target="_blank" rel="noopener noreferrer" href="https://twitter.com/@sathyasarathi90" class="m-1"><svg class="text-twitter h-4 w-4" fill="currentColor" viewBox="0 0 24 24"><path d="M8.29 20.251c7.547 0 11.675-6.253 11.675-11.675 0-.178 0-.355-.012-.53A8.348 8.348 0 0022 5.92a8.19 8.19 0 01-2.357.646 4.118 4.118 0 001.804-2.27 8.224 8.224 0 01-2.605.996 4.107 4.107 0 00-6.993 3.743 11.65 11.65 0 01-8.457-4.287 4.106 4.106 0 001.27 5.477A4.072 4.072 0 012.8 9.713v.052a4.105 4.105 0 003.292 4.022 4.095 4.095 0 01-1.853.07 4.108 4.108 0 003.834 2.85A8.233 8.233 0 012 18.407a11.616 11.616 0 006.29 1.84"></path></svg></a><a target="_blank" rel="noopener noreferrer" href="https://datawrangler.in" class="m-1"><svg class="text-gray-700 h-4 w-4" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM4.332 8.027a6.012 6.012 0 011.912-2.706C6.512 5.73 6.974 6 7.5 6A1.5 1.5 0 019 7.5V8a2 2 0 004 0 2 2 0 011.523-1.943A5.977 5.977 0 0116 10c0 .34-.028.675-.083 1H15a2 2 0 00-2 2v2.197A5.973 5.973 0 0110 16v-2a2 2 0 00-2-2 2 2 0 01-2-2 2 2 0 00-1.668-1.973z" clip-rule="evenodd"></path></svg></a></div><div class="mt-4"><div><p>Pythonist 🐍| Linux Geek who codes on WSL | Data & Cloud Fanatic | Blogging Advocate | Author</p> </div></div></div></div></div></div><div class="flex content-start flex-wrap"><div class="mt-6 flex items-center w-1/3"><div class="flex-shrink-0"><a href="/author/marcus/"><div class="lazyload-wrapper "><div style="height:3.5rem" class="lazyload-placeholder"></div></div></a></div><div class="ml-3"><a href="/author/marcus/" class="text-sm leading-5 font-medium"><span class="text-gray-900">Marcus Sanatan</span></a><div class="flex text-sm leading-5 text-gray-500 italic">Editor</div></div></div></div></div><div class="sm:mt-12 sm:p-3 sm:border-2"><div class="lazyload-wrapper "><div style="height:800px" class="lazyload-placeholder"></div></div></div></div><div class="col-span-7 pl-8"><div class="pb-4"><div class=" my-4 flex justify-center" style="min-height:600px"><div id="adngin-sidebar1-0"></div></div></div><div class="hidden md:block py-4"><h2 class="my-2 text-sm leading-4 font-extrabold text-gray-700 uppercase">In this <!-- -->article</h2><div class="my-2 w-24 h-0.5 bg-primary"></div><ul class="text-sm"><li><a class="block py-1 transform transition-colors duration-200 text-gray-500 hover:text-gray-800 hover:no-underline" href="#introduction">Introduction</a></li><li><a class="block py-1 transform transition-colors duration-200 text-gray-500 hover:text-gray-800 hover:no-underline" href="#whatiselasticdumpandwhyuseit">What Is Elasticdump, and Why Use It?</a></li><li><a class="block py-1 transform transition-colors duration-200 text-gray-500 hover:text-gray-800 hover:no-underline" href="#settingupelasticdump">Setting up Elasticdump</a></li><li><a class="block ml-4 py-1 transform transition-colors duration-200 text-gray-500 hover:text-gray-800 hover:no-underline" href="#installation">Installation</a></li><li><a class="block ml-4 py-1 transform transition-colors duration-200 text-gray-500 hover:text-gray-800 hover:no-underline" href="#settingupanelasticsearchclusteroptional">Setting Up an Elasticsearch Cluster (Optional)</a></li><li><a class="block py-1 transform transition-colors duration-200 text-gray-500 hover:text-gray-800 hover:no-underline" href="#workingwithelasticdump">Working with Elasticdump</a></li><li><a class="block ml-4 py-1 transform transition-colors duration-200 text-gray-500 hover:text-gray-800 hover:no-underline" href="#restoringtheindex">Restoring the Index</a></li><li><a class="block ml-4 py-1 transform transition-colors duration-200 text-gray-500 hover:text-gray-800 hover:no-underline" href="#copyingtheindexacrossclusters">Copying the Index Across Clusters</a></li><li><a class="block py-1 transform transition-colors duration-200 text-gray-500 hover:text-gray-800 hover:no-underline" href="#conclusion">Conclusion</a></li></ul></div><div class="py-4"><a href="https://pingbot.dev/?ref=stackabuse-1" class="hover:no-underline course-link" target="_blank" rel="sponsored noopener"><div class="flex flex-col border rounded-lg shadow overflow-hidden"><div class="aspect-w-16 aspect-h-9 rounded-t-lg border-2 border-gray-700"><div class="h-full w-full overflow-hidden"><div class="relative"><img class="rounded-lg object-cover" src="https://s3.pingbot.dev/images/monitor-overview.png" alt=""/></div></div></div><div class="flex-1 bg-white p-4 flex flex-col justify-between"><div class="flex-1"><div class="w-full text-base leading-5 flex justify-between"><span class="text-primary">Free</span></div><h3 class="mt-2 text-xl leading-7 font-semibold text-gray-900 hover:text-gray-900 hover:no-underline">Monitor with Ping Bot</h3><div class="inline-flex items-center mr-2 px-2.5 py-0.5 rounded-md text-xs font-medium bg-gray-200 text-gray-700 hover:text-gray-900"><span class="text-gray-400">#</span> <!-- -->monitoring</div><div class="inline-flex items-center mr-2 px-2.5 py-0.5 rounded-md text-xs font-medium bg-gray-200 text-gray-700 hover:text-gray-900"><span class="text-gray-400">#</span> <!-- -->uptime</div><div class="inline-flex items-center mr-2 px-2.5 py-0.5 rounded-md text-xs font-medium bg-gray-200 text-gray-700 hover:text-gray-900"><span class="text-gray-400">#</span> <!-- -->observability</div><p class="mt-4 text-sm leading-6 text-gray-500 break-words">Reliable monitoring for your app, databases, infrastructure, and the vendors they rely on. Ping Bot is a powerful uptime and performance monitoring tool that helps notify you and resolve issues before they affect your customers.</p></div><div class="mt-6 flex justify-between text-sm text-gray-600"><div class="flex flex-nowrap items-center gap-x-2 gap-y-2"><img src="https://s3.pingbot.dev/icons/system/openai.png" alt="OpenAI" title="OpenAI" class="h-6 w-6 rounded-full ring-2 ring-white"/><img src="https://s3.pingbot.dev/icons/system/vercel.png" alt="Vercel" title="Vercel" class="h-6 w-6 rounded-full ring-2 ring-white"/><img src="https://s3.pingbot.dev/icons/system/github.svg" alt="GitHub" title="GitHub" class="h-6 w-6 rounded-full ring-2 ring-white"/><img src="https://s3.pingbot.dev/icons/system/cloudflare.png" alt="MongoDB" title="MongoDB" class="h-6 w-6 rounded-full ring-2 ring-white"/><img src="https://s3.pingbot.dev/icons/system/postgres.svg" alt="PostgreSQL" title="PostgreSQL" class="h-6 w-6 rounded-full ring-2 ring-white"/></div><div class=""><div class="inline-flex items-center px-2 py-2 border border-gray-300 shadow-sm font-bold text-sm font-medium rounded text-gray-700 bg-white hover:bg-gray-100 hover:text-gray-700 focus:outline-none hover:no-underline">Learn more<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true" class="ml-1 w-5 h-5"><path stroke-linecap="round" stroke-linejoin="round" d="M13 7l5 5m0 0l-5 5m5-5H6"></path></svg></div></div></div></div></div></a></div><div class="py-4"><div class=" my-4 flex justify-center" style="min-height:600px"><div id="adngin-sidebar2-0"></div></div></div><div class="py-4"><a href="https://pingbot.dev/?ref=stackabuse-2" class="hover:no-underline course-link" target="_blank" rel="sponsored noopener"><div class="flex flex-col border rounded-lg shadow overflow-hidden"><div class="aspect-w-16 aspect-h-9 rounded-t-lg border-2 border-gray-700 flex items-center"><div class="h-full w-full overflow-hidden"><div class="relative h-full flex flex-col justify-center "><img class="rounded-lg object-cover" src="https://s3.pingbot.dev/images/vendor-status.png" alt=""/></div></div></div><div class="flex-1 bg-white p-4 flex flex-col justify-between"><div class="flex-1"><div class="w-full text-base leading-5 flex justify-between"><span class="text-primary">Free</span></div><h3 class="mt-2 text-xl leading-7 font-semibold text-gray-900 hover:text-gray-900 hover:no-underline">Vendor Alerts with Ping Bot</h3><div class="inline-flex items-center mr-2 px-2.5 py-0.5 rounded-md text-xs font-medium bg-gray-200 text-gray-700 hover:text-gray-900"><span class="text-gray-400">#</span> <!-- -->monitoring</div><div class="inline-flex items-center mr-2 px-2.5 py-0.5 rounded-md text-xs font-medium bg-gray-200 text-gray-700 hover:text-gray-900"><span class="text-gray-400">#</span> <!-- -->uptime</div><div class="inline-flex items-center mr-2 px-2.5 py-0.5 rounded-md text-xs font-medium bg-gray-200 text-gray-700 hover:text-gray-900"><span class="text-gray-400">#</span> <!-- -->observability</div><p class="mt-4 text-sm leading-6 text-gray-500 break-words">Get detailed incident alerts about the status of your favorite vendors. Don't learn about downtime from your customers, be the first to know with Ping Bot.</p></div><div class="mt-6 flex justify-between text-sm text-gray-600"><div class="flex flex-nowrap items-center gap-x-2 gap-y-2"><img src="https://s3.pingbot.dev/icons/system/supabase.png" alt="Supabase" title="Supabase" class="h-6 w-6 rounded-full ring-2 ring-white"/><img src="https://s3.pingbot.dev/icons/system/digitalocean.png" alt="DigitalOcean" title="DigitalOcean" class="h-6 w-6 rounded-full ring-2 ring-white"/><img src="https://s3.pingbot.dev/icons/system/mailgun.png" alt="Mailgun" title="Mailgun" class="h-6 w-6 rounded-full ring-2 ring-white"/><img src="https://s3.pingbot.dev/icons/system/segment.png" alt="Segment" title="Segment" class="h-6 w-6 rounded-full ring-2 ring-white"/><img src="https://s3.pingbot.dev/icons/system/zapier.ico" alt="Zapier" title="Zapier" class="h-6 w-6 rounded-full ring-2 ring-white"/></div><div class=""><div class="inline-flex items-center px-2 py-2 border border-gray-300 shadow-sm font-bold text-sm font-medium rounded text-gray-700 bg-white hover:bg-gray-100 hover:text-gray-700 focus:outline-none hover:no-underline">Learn more<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true" class="ml-1 w-5 h-5"><path stroke-linecap="round" stroke-linejoin="round" d="M13 7l5 5m0 0l-5 5m5-5H6"></path></svg></div></div></div></div></div></a></div><div class="py-4 sticky top-0"><div class=""><div class=" my-4 flex justify-center" style="min-height:600px"><div id="adngin-sidebar3-0"></div></div></div></div></div></div></div></div></main><div class="bg-white border-t border-gray-300"><div class="max-w-screen-xl mx-auto pt-12 pb-6 px-4 sm:px-6 md:flex md:items-center md:justify-between lg:px-8"><div class="flex justify-center md:order-2"><a href="https://twitter.com/stackabuse" target="_blank" rel="noreferrer noopener" class="text-gray-500 hover:text-twitter"><span class="sr-only">Twitter</span><svg class="h-6 w-6" fill="currentColor" viewBox="0 0 24 24"><path d="M8.29 20.251c7.547 0 11.675-6.253 11.675-11.675 0-.178 0-.355-.012-.53A8.348 8.348 0 0022 5.92a8.19 8.19 0 01-2.357.646 4.118 4.118 0 001.804-2.27 8.224 8.224 0 01-2.605.996 4.107 4.107 0 00-6.993 3.743 11.65 11.65 0 01-8.457-4.287 4.106 4.106 0 001.27 5.477A4.072 4.072 0 012.8 9.713v.052a4.105 4.105 0 003.292 4.022 4.095 4.095 0 01-1.853.07 4.108 4.108 0 003.834 2.85A8.233 8.233 0 012 18.407a11.616 11.616 0 006.29 1.84"></path></svg></a><a href="https://github.com/stackabuse" target="_blank" rel="noreferrer noopener" class="ml-6 text-gray-500 hover:text-github"><span class="sr-only">GitHub</span><svg class="h-6 w-6" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z" clip-rule="evenodd"></path></svg></a><a href="https://www.facebook.com/stackabuse" target="_blank" rel="noreferrer noopener" class="ml-6 text-gray-500 hover:text-facebook"><span class="sr-only">Facebook</span><svg class="h-6 w-6" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M22 12c0-5.523-4.477-10-10-10S2 6.477 2 12c0 4.991 3.657 9.128 8.438 9.878v-6.987h-2.54V12h2.54V9.797c0-2.506 1.492-3.89 3.777-3.89 1.094 0 2.238.195 2.238.195v2.46h-1.26c-1.243 0-1.63.771-1.63 1.562V12h2.773l-.443 2.89h-2.33v6.988C18.343 21.128 22 16.991 22 12z" clip-rule="evenodd"></path></svg></a></div><div class="mt-8 md:mt-0 md:order-1"><p class="text-center text-base leading-6 text-gray-500">© 2013-<!-- -->2025<!-- --> Stack Abuse. All rights reserved.</p><div class="text-sm"><a href="/about" class="pr-4 text-gray-500 border-r-2 border-grey-400 hover:no-underline hover:text-gray-600">About</a><a href="/disclosure" class="px-4 text-gray-500 border-r-2 border-grey-400 hover:no-underline hover:text-gray-600">Disclosure</a><a href="/privacy-policy" class="px-4 text-gray-500 border-r-2 border-grey-400 hover:no-underline hover:text-gray-600">Privacy</a><a href="/terms-of-service" class="pl-4 text-gray-500 hover:no-underline hover:text-gray-600">Terms</a><div id="ccpa" style="display:none;cursor:pointer">Do not share my Personal Information.</div></div></div></div></div></div></div><script data-cfasync="false" src="/cdn-cgi/scripts/5c5dd728/cloudflare-static/email-decode.min.js"></script><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"content":{"id":983,"title":"Guide to Elasticdump - Moving and Saving Elasticsearch Indices","slug":"guide-to-elasticdump-moving-and-saving-elasticsearch-indices","body_html":"\u003ch2 id=\"introduction\"\u003eIntroduction\u003c/h2\u003e\n\u003cp\u003eElasticsearch initially began as a custom search engine. These days, it has gone above and beyond that singular role as it's part of \u003cem\u003elog aggregation stacks\u003c/em\u003e, \u003cem\u003esecurity monitoring\u003c/em\u003e, and even as a \u003cem\u003edatastore for performing exploratory analysis\u003c/em\u003e.\u003c/p\u003e\n\u003cp\u003eIndices in Elasticsearch are where the data is stored, and there are often times when these indices need to be transported from one cluster to another. Perhaps we just need a safe backup before moving data to another cluster or upgrading versions. Elasticdump is a tool that helps in facilitating this backup and restore operation.\u003c/p\u003e\n\u003cblockquote\u003e\n\u003cp\u003e\u003cem\u003eElasticdump\u003c/em\u003e is a tool made to move and save Elasticsearch indices.\u003c/p\u003e\n\u003c/blockquote\u003e\n\u003cp\u003eIn this guide, we'll take a look at how to use \u003cem\u003eElasticdump\u003c/em\u003e and how to create and move indices between clusters on your local computer.\u003c/p\u003e\n\n \u003cdiv class=\"alert alert-note\"\u003e\n \u003cdiv class=\"flex\"\u003e\n \n \u003cdiv class=\"flex-shrink-0 mr-3\"\u003e\n \u003cimg src=\"/assets/images/icon-information-circle-solid.svg\" class=\"icon\" aria-hidden=\"true\" /\u003e\n \u003c/div\u003e\n \n \u003cdiv class=\"w-full\"\u003e\n \u003cp\u003e\u003cstrong\u003eNote:\u003c/strong\u003e To follow this tutorial, you need to have \u003ca href=\"/docker-a-high-level-introduction\" target=\"_blank\"\u003edocker installed\u003c/a\u003e, as well as \u003ca href=\"/how-to-install-node-js-on-ubuntu\" target=\"_blank\"\u003eNPM\u003c/a\u003e.\u003c/p\u003e\n\n \u003c/div\u003e\n \u003c/div\u003e\n \u003c/div\u003e\n \u003ch2 id=\"whatiselasticdumpandwhyuseit\"\u003eWhat Is Elasticdump, and Why Use It?\u003c/h2\u003e\n\u003cp\u003eThose familiar with Elasticsearch would know of its \u003cem\u003e\u0026quot;Snapshot and Restore\u0026quot;\u003c/em\u003e feature to facilitate these operations. Yes, it is indeed a smart feature that helps back up individual indices or an entire cluster. While exploring that option for a small number of indices or clusters, you may find that using the \u003cem\u003e\u0026quot;Snapshot and Restore\u0026quot;\u003c/em\u003e feature could be an overkill. This is even more pronounced when there's no system to incrementally take snapshots.\u003c/p\u003e\n\u003cp\u003eThis is where Elasticdump can help - it's a lightweight tool that can move and save indices with a remote repository required by Elasticsearch's \u003cem\u003e\u0026quot;Snapshot and Restore\u0026quot;\u003c/em\u003e.\u003c/p\u003e\n\u003cp\u003eHere's what Elasticdump can do:\u003c/p\u003e\n\u003cul\u003e\n\u003cli\u003eCopy the indices from one cluster to the other\u003c/li\u003e\n\u003cli\u003eDump indices to flat files\u003c/li\u003e\n\u003cli\u003eBack up indices \u0026amp; mappings\u003c/li\u003e\n\u003cli\u003eRestore indices across different versions of Elasticsearch\u003c/li\u003e\n\u003cli\u003eMultielasticdump that comes along with Elasticdump can export multiple indices in parallel\u003c/li\u003e\n\u003c/ul\u003e\n\u003ch2 id=\"settingupelasticdump\"\u003eSetting up Elasticdump\u003c/h2\u003e\n\u003ch3 id=\"installation\"\u003eInstallation\u003c/h3\u003e\n\u003cp\u003eElasticdump is a Node package and it can be directly downloaded from \u003ca href=\"https://www.npmjs.com/package/elasticdump\" target=\"_blank\" rel=\"noopener nofollow\"\u003eNPM\u003c/a\u003e. We'll need to have Node.js installed, alongside the Node Package Manager (NPM).\u003c/p\u003e\n\u003cp\u003eLet's go ahead and install them, before downloading Elasticdump:\u003c/p\u003e\n\u003cpre\u003e\u003ccode class=\"hljs\"\u003e\u003cspan class=\"hljs-meta\"\u003e$\u003c/span\u003e\u003cspan class=\"bash\"\u003e sudo apt install nodejs npm \u003cspan class=\"hljs-comment\"\u003e# Install Node.js + NPM\u003c/span\u003e\u003c/span\u003e\n\u003cspan class=\"hljs-meta\"\u003e$\u003c/span\u003e\u003cspan class=\"bash\"\u003e sudo npm install n -g \u003cspan class=\"hljs-comment\"\u003e# Install helper package to get latest Node.js + NPM versions\u003c/span\u003e\u003c/span\u003e\n/usr/local/bin/n -\u0026gt; /usr/local/lib/node_modules/n/bin/n\n/usr/local/lib\n└── n@7.2.2\n\u003cspan class=\"hljs-meta\"\u003e$\u003c/span\u003e\u003cspan class=\"bash\"\u003e sudo n latest \u003cspan class=\"hljs-comment\"\u003e# Get latest version of NPM\u003c/span\u003e\u003c/span\u003e\n\n installing : node-v16.2.0\n mkdir : /usr/local/n/versions/node/16.2.0\n fetch : https://nodejs.org/dist/v16.2.0/node-v16.2.0-linux-x64.tar.xz\n installed : v16.2.0 (with npm 7.13.0)\n\nNote: the node command changed location and the old location may be remembered in your current shell.\n old : /usr/bin/node\n new : /usr/local/bin/node\nTo reset the command location hash either start a new shell or execute PATH=\u0026quot;$PATH\u0026quot;\n\u003cspan class=\"hljs-meta\"\u003e\n$\u003c/span\u003e\u003cspan class=\"bash\"\u003e sudo npm install elasticdump -g \u003cspan class=\"hljs-comment\"\u003e# Install Elasticdump globally on your local machine\u003c/span\u003e\u003c/span\u003e\n\u003c/code\u003e\u003c/pre\u003e\n\u003cp\u003eThis installs Elasticdump globally and the installation can be verified using the following command:\u003c/p\u003e\n\u003cpre\u003e\u003ccode class=\"hljs\"\u003e\u003cspan class=\"hljs-meta\"\u003e$\u003c/span\u003e\u003cspan class=\"bash\"\u003e elasticdump --version\u003c/span\u003e\n6.71.0\n\u003c/code\u003e\u003c/pre\u003e\n\u003ch3 id=\"settingupanelasticsearchclusteroptional\"\u003eSetting Up an Elasticsearch Cluster (Optional)\u003c/h3\u003e\n\u003cp\u003eTo test Elasticdump out, you will have to have at least one Elasticsearch cluster with a single node setup. If you have an Elasticsearch cluster running already, \u003cu\u003e\u003ca href=\"#elasticdumpinaction\"\u003eyou may skip this step\u003c/a\u003e\u003c/u\u003e.\u003c/p\u003e\n\u003cp\u003eFor others, the following commands will spin up an Elasticsearch container for you. Make sure you have Docker or Docker Desktop installed and running on your machine. You can download your suitable installer from \u003ca href=\"https://www.docker.com/products/docker-desktop\" target=\"_blank\" rel=\"noopener nofollow\"\u003ehere\u003c/a\u003e.\u003c/p\u003e\n\u003cp\u003eOnce your Docker server is up and running, let's create a directory, which will contain the volume to hold Elasticsearch's data. If this is not done, Elasticsearch volume would be \u003cem\u003eephemeral\u003c/em\u003e and your data will be lost if the container goes down:\u003c/p\u003e\n\u003cpre\u003e\u003ccode class=\"hljs\"\u003e\u003cspan class=\"hljs-meta\"\u003e$\u003c/span\u003e\u003cspan class=\"bash\"\u003e mkdir -p data/ES9200\u003c/span\u003e\n\u003cspan class=\"hljs-meta\"\u003e$\u003c/span\u003e\u003cspan class=\"bash\"\u003e mkdir -p data/ES9400\u003c/span\u003e\n\u003cspan class=\"hljs-meta\"\u003e$\u003c/span\u003e\u003cspan class=\"bash\"\u003e vol_location=`\u003cspan class=\"hljs-built_in\"\u003epwd\u003c/span\u003e`\u003c/span\u003e\n\u003c/code\u003e\u003c/pre\u003e\n\u003cp\u003eYou can now spin up your Elasticsearch container by keying in the following command:\u003c/p\u003e\n\u003cpre\u003e\u003ccode class=\"hljs\"\u003e\u003cspan class=\"hljs-meta\"\u003e$\u003c/span\u003e\u003cspan class=\"bash\"\u003e docker run -p 9200:9200 -p 9300:9300 -e \u003cspan class=\"hljs-string\"\u003e\u0026quot;discovery.type=single-node\u0026quot;\u003c/span\u003e -v \u003cspan class=\"hljs-variable\"\u003e${vol_location}\u003c/span\u003e/data/es9200:/usr/share/elasticsearch/data --name=es_source -d docker.elastic.co/elasticsearch/elasticsearch:7.13.0\u003c/span\u003e\n\u003c/code\u003e\u003c/pre\u003e\n\u003cp\u003eLet's break this command down a bit.\u003c/p\u003e\n\u003cp\u003eWe've commanded Docker to publish (\u003ccode\u003e-p\u003c/code\u003e flag) port \u003ccode\u003e9200\u003c/code\u003e on your host machine to the \u003ccode\u003e9200\u003c/code\u003e port on your container, and the same process is then run for \u003ccode\u003e9300\u003c/code\u003e. We have also assigned an environment variable (\u003ccode\u003e-e\u003c/code\u003e flag) stating that it is going to be a single node setup.\u003c/p\u003e\n\u003cp\u003eThen, we attach the volume (\u003ccode\u003e-v\u003c/code\u003e flag) to the directory created in the previous setup, mapped to the data directory inside the container, in which the data will be stored.\u003c/p\u003e\n\u003cp\u003eFinally, the \u003ccode\u003e--name\u003c/code\u003e flag is to give a nice name to the container while the \u003ccode\u003e-d\u003c/code\u003e flag is to make the container run in the background, and \u003ccode\u003edocker.elastic.co/elasticsearch/elasticsearch:7.13.0\u003c/code\u003e is the name of the image.\u003c/p\u003e\n\u003cp\u003eWe'll copy data from this Elasticsearch cluster to another cluster, using Elasticdump. To make this happen, you can create another cluster known as \u003ccode\u003ees_target\u003c/code\u003e by issuing the following command:\u003c/p\u003e\n\u003cpre\u003e\u003ccode class=\"hljs\"\u003e\u003cspan class=\"hljs-meta\"\u003e$\u003c/span\u003e\u003cspan class=\"bash\"\u003e docker run -p 9400:9200 -p 9500:9300 -e \u003cspan class=\"hljs-string\"\u003e\u0026quot;discovery.type=single-node\u0026quot;\u003c/span\u003e -v \u003cspan class=\"hljs-variable\"\u003e${vol_location}\u003c/span\u003e/data/es9400:/usr/share/elasticsearch/data --name=es_target -d docker.elastic.co/elasticsearch/elasticsearch:7.13.0\u003c/span\u003e\n\u003c/code\u003e\u003c/pre\u003e\n\u003cp\u003e\u003cstrong\u003eNote:\u003c/strong\u003e The service won't run on a port that's already being used by another service.\u003c/p\u003e\n\u003cp\u003eYou can check if your Elasticsearch cluster containers are running fine by issuing the following command:\u003c/p\u003e\n\u003cpre\u003e\u003ccode class=\"hljs\"\u003e\u003cspan class=\"hljs-meta\"\u003e$\u003c/span\u003e\u003cspan class=\"bash\"\u003e docker ps\u003c/span\u003e\nCONTAINER ID IMAGE COMMAND CREATED\nSTATUS PORTS NAMES\nc0aa983abb21 docker.elastic.co/elasticsearch/elasticsearch:7.13.0 \u0026quot;/bin/tini -- /usr/l…\u0026quot; 9 hours ago\nUp 2 hours 0.0.0.0:9400-\u0026gt;9200/tcp, :::9400-\u0026gt;9200/tcp, 0.0.0.0:9500-\u0026gt;9300/tcp, :::9500-\u0026gt;9300/tcp es_target\neb30714b5302 docker.elastic.co/elasticsearch/elasticsearch:7.13.0 \u0026quot;/bin/tini -- /usr/l…\u0026quot; 10 hours ago Up 3 hours 0.0.0.0:9200-\u0026gt;9200/tcp, :::9200-\u0026gt;9200/tcp, 0.0.0.0:9300-\u0026gt;9300/tcp, :::9300-\u0026gt;9300/tcp es_source\n\u003c/code\u003e\u003c/pre\u003e\n\u003cp\u003eThe containers that you have created look good! Let's dive into the usage of Elasticdump.\u003c/p\u003e\n\u003ch2 id=\"workingwithelasticdump\"\u003eWorking with Elasticdump\u003c/h2\u003e\n\u003cp\u003eWith a container ready, we can start working with Elasticdump.\u003c/p\u003e\n\u003ch3 id=\"restoringtheindex\"\u003eRestoring the Index\u003c/h3\u003e\n\u003cp\u003eThe clusters are ready, but they look empty. Let's create an index and load data to one of the clusters. The \u003ccode\u003ees_source\u003c/code\u003e cluster runs on port \u003ccode\u003e9200\u003c/code\u003e and can be accessed via \u003ccode\u003ehttp://localhost:9200\u003c/code\u003e. Run the following commands to download the mapping and the data to be loaded:\u003c/p\u003e\n\u003cpre\u003e\u003ccode class=\"hljs\"\u003e\u003cspan class=\"hljs-meta\"\u003e$\u003c/span\u003e\u003cspan class=\"bash\"\u003e wget https://raw.githubusercontent.com/StackAbuse/moving-elasticsearch-indices-with-elasticdump/main/logs_mapping.json\u003c/span\u003e\n\u003cspan class=\"hljs-meta\"\u003e$\u003c/span\u003e\u003cspan class=\"bash\"\u003e wget https://raw.githubusercontent.com/StackAbuse/moving-elasticsearch-indices-with-elasticdump/main/logs_data.json\u003c/span\u003e\n\u003c/code\u003e\u003c/pre\u003e\n\u003cp\u003eLet's try loading these files to the \u003ccode\u003ees_source\u003c/code\u003e cluster under the index \u003ccode\u003elog-2021-06-01\u003c/code\u003e using Elasticdump:\u003c/p\u003e\n\u003cpre\u003e\u003ccode class=\"hljs\"\u003e\u003cspan class=\"hljs-meta\"\u003e$\u003c/span\u003e\u003cspan class=\"bash\"\u003e elasticdump --input=logs_mapping.json --output=http://localhost:9200/log-2021-06-01 --\u003cspan class=\"hljs-built_in\"\u003etype\u003c/span\u003e=mapping\u003c/span\u003e\n\u003cspan class=\"hljs-meta\"\u003e$\u003c/span\u003e\u003cspan class=\"bash\"\u003e elasticdump --input=logs_data.json --output=http://localhost:9200/logindex --\u003cspan class=\"hljs-built_in\"\u003etype\u003c/span\u003e=data\u003c/span\u003e\n\u003c/code\u003e\u003c/pre\u003e\n\u003cp\u003eThere are three flags here: \u003ccode\u003e--input\u003c/code\u003e corresponds to the JSON file that we have downloaded, \u003ccode\u003e--output\u003c/code\u003e corresponds to the cluster endpoint, and \u003ccode\u003e--type\u003c/code\u003e corresponds to either mapping or data which defines what to export.\u003c/p\u003e\n\u003cp\u003eElasticdump takes the input as these files and writes the output to the \u003ccode\u003elog-2021-06-01\u003c/code\u003e index as:\u003c/p\u003e\n\u003cpre\u003e\u003ccode class=\"hljs\"\u003e\u003cspan class=\"hljs-meta\"\u003e$\u003c/span\u003e\u003cspan class=\"bash\"\u003e elasticdump --input=logs_mapping.json --output=http://localhost:9200/log-2021-06-01 --\u003cspan class=\"hljs-built_in\"\u003etype\u003c/span\u003e=mapping\u003c/span\u003e\nSat, 05 Jun 2021 12:30:52 GMT | starting dump\nSat, 05 Jun 2021 12:30:52 GMT | got 1 objects from source file (offset: 0)\nSat, 05 Jun 2021 12:30:59 GMT | sent 1 objects to destination elasticsearch, wrote 1\nSat, 05 Jun 2021 12:30:59 GMT | got 0 objects from source file (offset: 1)\nSat, 05 Jun 2021 12:30:59 GMT | Total Writes: 1\nSat, 05 Jun 2021 12:30:59 GMT | dump complete\n\u003cspan class=\"hljs-meta\"\u003e\n$\u003c/span\u003e\u003cspan class=\"bash\"\u003e elasticdump --input=logs_data.json --output=http://localhost:9200/log-2021-06-01 --\u003cspan class=\"hljs-built_in\"\u003etype\u003c/span\u003e=data\u003c/span\u003e\nSat, 05 Jun 2021 12:31:23 GMT | starting dump\nSat, 05 Jun 2021 12:31:24 GMT | got 100 objects from source file (offset: 0)\nSat, 05 Jun 2021 12:31:26 GMT | sent 100 objects to destination elasticsearch, wrote 100\nSat, 05 Jun 2021 12:31:26 GMT | got 100 objects from source file (offset: 100)\nSat, 05 Jun 2021 12:31:27 GMT | sent 100 objects to destination elasticsearch, wrote 100\nSat, 05 Jun 2021 12:31:27 GMT | got 100 objects from source file (offset: 200)\nSat, 05 Jun 2021 12:31:28 GMT | sent 100 objects to destination elasticsearch, wrote 100\nSat, 05 Jun 2021 12:31:28 GMT | got 0 objects from source file (offset: 300)\nSat, 05 Jun 2021 12:31:28 GMT | got 0 objects from source file (offset: 300)\nSat, 05 Jun 2021 12:31:28 GMT | Total Writes: 300\nSat, 05 Jun 2021 12:31:28 GMT | dump complete\n\u003c/code\u003e\u003c/pre\u003e\n\u003cp\u003eLet's check if the restoration is completed successfully:\u003c/p\u003e\n\u003cpre\u003e\u003ccode class=\"hljs\"\u003e\u003cspan class=\"hljs-meta\"\u003e$\u003c/span\u003e\u003cspan class=\"bash\"\u003e curl localhost:9200/_cat/indices\u003c/span\u003e\nyellow open log-2021-06-01 UD4SRzu-TjCNdVZatdOQsA 1 1 300 0 305.5kb 305.5kb\n\u003c/code\u003e\u003c/pre\u003e\n\u003cp\u003eThere are 300 documents in Elasticsearch constituting a total size of \u003ccode\u003e305.5kb\u003c/code\u003e.\u003c/p\u003e\n\u003ch3 id=\"copyingtheindexacrossclusters\"\u003eCopying the Index Across Clusters\u003c/h3\u003e\n\u003cp\u003eThe syntax seen above is similar across the usage of Elasticdump for different scenarios. Let's now copy the index created previously into a new index on another cluster:\u003c/p\u003e\n\u003cpre\u003e\u003ccode class=\"hljs\"\u003e\u003cspan class=\"hljs-meta\"\u003e$\u003c/span\u003e\u003cspan class=\"bash\"\u003e elasticdump --input=http://localhost:9200/log-2021-06-01 --output=http://localhost:9400/log-2021-06-01\u003c/span\u003e\nSat, 05 Jun 2021 10:05:24 GMT | starting dump\nSat, 05 Jun 2021 10:05:24 GMT | got 100 objects from source elasticsearch (offset: 0)\nSat, 05 Jun 2021 10:05:28 GMT | sent 100 objects to destination elasticsearch, wrote 100\nSat, 05 Jun 2021 10:05:28 GMT | got 100 objects from source elasticsearch (offset: 100)\nSat, 05 Jun 2021 10:05:28 GMT | sent 100 objects to destination elasticsearch, wrote 100\nSat, 05 Jun 2021 10:05:28 GMT | got 100 objects from source elasticsearch (offset: 200)\nSat, 05 Jun 2021 10:05:30 GMT | sent 100 objects to destination elasticsearch, wrote 100\nSat, 05 Jun 2021 10:05:30 GMT | got 0 objects from source elasticsearch (offset: 300)\nSat, 05 Jun 2021 10:05:30 GMT | Total Writes: 300\nSat, 05 Jun 2021 10:05:30 GMT | dump complete\n\u003c/code\u003e\u003c/pre\u003e\n\u003cp\u003eElasticdump will create a new index for you if the output index doesn't exist. Let's again verify if the index has been created properly.\u003c/p\u003e\n\u003cpre\u003e\u003ccode class=\"hljs\"\u003e\u003cspan class=\"hljs-meta\"\u003e$\u003c/span\u003e\u003cspan class=\"bash\"\u003e curl localhost:9400/_cat/indices\u003c/span\u003e\nyellow open log-2021-06-01 UD4SRzu-TjCNdVZatdOQsA 1 1 300 0 305.5kb 305.5kb\n\u003c/code\u003e\u003c/pre\u003e\n\u003ch2 id=\"conclusion\"\u003eConclusion\u003c/h2\u003e\n\u003cp\u003eAs simple as it sounds, the Elasticdump tool is a must-have tool for anyone dealing with Elasticsearch.\u003c/p\u003e\n","parent_id":null,"type":"article","visibility":"public","img_feature":null,"is_featured":false,"locale":"en","custom_excerpt":null,"inject_header":null,"inject_footer":null,"canonical_url":null,"comment_id":null,"og_image":null,"og_title":null,"og_description":null,"twitter_image":null,"twitter_title":null,"twitter_description":null,"meta_title":null,"meta_description":"Elasticdump is a lightweight tool that copies data to and from Elasticsearch indices. In this guide, we'll take a look at how to install and use Elasticdump to make your work with Elasticsearch easier.","read_time_min":12,"published_at":1623216600000,"created_at":1623125345451,"updated_at":1678127575013,"contributors":[{"id":24,"name":"Marcus Sanatan","slug":"marcus","role_id":2,"img_profile":"//www.gravatar.com/avatar/9338700b1e5acdfd87482b0019aff5b7?s=250\u0026d=mm\u0026r=x","img_cover":null,"bio_html":"\u003cp\u003eWeb Dev|Games|Music|Art|Fun|Caribbean\u003c/p\u003e\n\u003cp\u003eI love many things and coding is one of them!\u003c/p\u003e\n","website":"https://msanatan.com","location":"Trinidad and Tobago","facebook":null,"twitter":"marcussanatan","github":"msanatan","created_at":1543339760000,"updated_at":1697580382340,"role":"editor","_pivot_content_id":983,"_pivot_user_id":24,"_pivot_role":"editor","_pivot_sort_order":0},{"id":77,"name":"Sathiya Sarathi Gunasekaran","slug":"datawrangl3r","role_id":4,"img_profile":"//s3.stackabuse.com/media/users/0d0cce90086957ab4e853e5b82249458.jpg","img_cover":null,"bio_html":"\u003cp\u003ePythonist 🐍| Linux Geek who codes on WSL | Data \u0026amp; Cloud Fanatic | Blogging Advocate | Author\u003c/p\u003e\n","website":"https://datawrangler.in","location":"Chennai, India","facebook":null,"twitter":"@sathyasarathi90","github":null,"created_at":1603129658000,"updated_at":1676493346756,"role":"author","_pivot_content_id":983,"_pivot_user_id":77,"_pivot_role":"author","_pivot_sort_order":1}],"tags":[{"id":29,"name":"unix","slug":"unix","img_cover":null,"description_html":"","og_image":null,"og_title":null,"og_description":null,"twitter_image":null,"twitter_title":null,"twitter_description":null,"meta_title":null,"meta_description":null,"inject_header":null,"inject_footer":null,"canonical_url":null,"color":null,"created_at":1431359835000,"updated_at":1431359835000,"_pivot_content_id":983,"_pivot_tag_id":29,"_pivot_sort_order":0},{"id":44,"name":"tool","slug":"tool","img_cover":null,"description_html":"","og_image":null,"og_title":null,"og_description":null,"twitter_image":null,"twitter_title":null,"twitter_description":null,"meta_title":null,"meta_description":null,"inject_header":null,"inject_footer":null,"canonical_url":null,"color":null,"created_at":1431360854000,"updated_at":1431360854000,"_pivot_content_id":983,"_pivot_tag_id":44,"_pivot_sort_order":1},{"id":48,"name":"node","slug":"node","img_cover":null,"description_html":"","og_image":null,"og_title":null,"og_description":null,"twitter_image":null,"twitter_title":null,"twitter_description":null,"meta_title":null,"meta_description":null,"inject_header":null,"inject_footer":null,"canonical_url":null,"color":null,"created_at":1437348872000,"updated_at":1437348872000,"_pivot_content_id":983,"_pivot_tag_id":48,"_pivot_sort_order":2}]},"relatedContent":[{"title":"Using Spies for Testing in JavaScript with Sinon.js","slug":"using-spies-for-testing-in-javascript-with-sinon","type":"article"},{"title":"NPM Throws Error without Sudo","slug":"npm-throws-error-without-sudo","type":"article"},{"title":"Using Mocks for Testing in JavaScript with Sinon.js","slug":"using-mocks-for-testing-in-javascript-with-sinon-js","type":"article"},{"title":"Using NVM to Install Node","slug":"using-nvm-to-install-node","type":"article"},{"title":"Run Periodic Tasks in Node with node-cron","slug":"run-periodic-tasks-in-node-with-node-cron","type":"article"}],"relatedCollections":[],"error":null},"__N_SSP":true},"page":"/[slug]","query":{"slug":"guide-to-elasticdump-moving-and-saving-elasticsearch-indices"},"buildId":"1739247265773","isFallback":false,"isExperimentalCompile":false,"gssp":true,"scriptLoader":[]}</script></body></html>