# How To export selected type elasticsearch from server A to server B

**URL:** <https://discuss.elastic.co/t/how-to-export-selected-type-elasticsearch-from-server-a-to-server-b/111746>\
**Category:** Elasticsearch\
**Created:** [December 14, 2017, 10:50am UTC](https://discuss.elastic.co/t/how-to-export-selected-type-elasticsearch-from-server-a-to-server-b/111746 "2017-12-14T10:50:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sharon\_wsf](https://avatars.discourse-cdn.com/v4/letter/s/7993a0/32.png) [@Sharon\_wsf](https://discuss.elastic.co/u/Sharon_wsf)\
**Post date:** [December 14, 2017, 10:50am UTC](https://discuss.elastic.co/t/how-to-export-selected-type-elasticsearch-from-server-a-to-server-b/111746/1 "2017-12-14T10:50:51Z")

</div>

Hi Team,

my version elasticsearch is 2.40.  
how to export selected type and fields data from elasticsearch server A to elastic server B.  
Version elasticsearch server A and server B also 2.40.

Thanks and best regards  
Sharon

---

<div class="post-metadata">

**Author:** ![luiz.santos](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/luiz.santos/32/24664_2.png) [@luiz.santos](https://discuss.elastic.co/u/luiz.santos)\
**Post date:** [December 22, 2017, 11:57am UTC](https://discuss.elastic.co/t/how-to-export-selected-type-elasticsearch-from-server-a-to-server-b/111746/2 "2017-12-22T11:57:09Z")

</div>

Hi Sharon,

In early versions of elasticsearch you could use [reindex from remote](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html#reindex-from-remote), but it is not available in version 2.4.0.

So you will need to define your own strategy to export this data. One of my favorites is to use [logstash](https://www.elastic.co/guide/en/logstash/current/getting-started-with-logstash.html) and define an input from source elasticsearch and an output to target elasticsearch.

Config file would be something like this:

```
input {
  # Read all documents from Elasticsearch matching the given query
  elasticsearch {
    hosts => "address_source_elasticsearch"
    query => '{ "query": { "match": { "statuscode": 200 } }, "sort": ["_doc"] }'
  }
}

output {
  elasticsearch {
    hosts => "address_target_elasticsearch"
  }
}

```

You can always create a script to do this work in your favorite language too.

Hope it helps.

Cheers,  
LG

---

<div class="post-metadata">

**Author:** ![shanec](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shanec/32/4004_2.png) [@shanec](https://discuss.elastic.co/u/shanec)\
**Post date:** [December 22, 2017, 3:01pm UTC](https://discuss.elastic.co/t/how-to-export-selected-type-elasticsearch-from-server-a-to-server-b/111746/3 "2017-12-22T15:01:32Z")

</div>

Just as a little text correction:

> [@luiz.santos](#):
>
> In early versions of elasticsearch you could use reindex from remote, but it is not available in version 2.4.0.

Should read

> In _later_ versions of elasticsearch you could use reindex from remote, but it is not available in version 2.4.0.

Reindex from remote was added in 5.0 of Elasticsearch: [Reindex API | Elasticsearch Guide [5.0] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/5.0/docs-reindex.html#reindex-from-remote), so if "server B" is or can be version 5.x, then you could use this. I would encourage you to consider upgrading to 5.x or 6.x whenever possible regardless of this particular technical hurdle because of ongoing performance, functionality, and security improvements.

Anyway, presuming 5.x or 6.x is not an option in your case, @luiz.santos's solution is a good one!

---

<div class="post-metadata">

**Author:** ![luiz.santos](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/luiz.santos/32/24664_2.png) [@luiz.santos](https://discuss.elastic.co/u/luiz.santos)\
**Post date:** [December 22, 2017, 3:20pm UTC](https://discuss.elastic.co/t/how-to-export-selected-type-elasticsearch-from-server-a-to-server-b/111746/4 "2017-12-22T15:20:12Z")

</div>

Thank you for the correction @shanec 🙂

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [January 19, 2018, 3:20pm UTC](https://discuss.elastic.co/t/how-to-export-selected-type-elasticsearch-from-server-a-to-server-b/111746/5 "2018-01-19T15:20:25Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
