# What's best way to drop a field while Remote Reindexing

**URL:** <https://discuss.elastic.co/t/whats-best-way-to-drop-a-field-while-remote-reindexing/87931>\
**Category:** Elasticsearch\
**Created:** [June 1, 2017, 2:50pm UTC](https://discuss.elastic.co/t/whats-best-way-to-drop-a-field-while-remote-reindexing/87931 "2017-06-01T14:50:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ritchierich](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ritchierich/32/4329_2.png) [@ritchierich](https://discuss.elastic.co/u/ritchierich)\
**Post date:** [June 1, 2017, 2:50pm UTC](https://discuss.elastic.co/t/whats-best-way-to-drop-a-field-while-remote-reindexing/87931/1 "2017-06-01T14:50:38Z")

</div>

I need to pull data from one ES Cluster to another ES Cluster, but I want to drop fields. For example, I'd like to drop user or ip address.

- Can I do this with reindex?
- Combination of reindex and ingest node?
- Use painless?

I'm running Elastic Stack v5.3.2

```
curl -XPOST host_1:9200/_reindex?wait_for_completion=true -d'{
"source": {
  "remote": {
    "host": "http://host_2:9200"
  },
  "index": "logstash-2017.05.31",
  "query": {
    "match": {
      "type": "web-service"
    }
  }
},
"dest": {
  "index": "logstash-web-service-2017.05.31"
}
}'

```

Thanks,  
Rich

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [June 1, 2017, 2:52pm UTC](https://discuss.elastic.co/t/whats-best-way-to-drop-a-field-while-remote-reindexing/87931/2 "2017-06-01T14:52:34Z")

</div>

You can do this by combining reindex with an ingest pipeline.

---

<div class="post-metadata">

**Author:** ![ritchierich](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ritchierich/32/4329_2.png) [@ritchierich](https://discuss.elastic.co/u/ritchierich)\
**Post date:** [June 27, 2017, 5:35am UTC](https://discuss.elastic.co/t/whats-best-way-to-drop-a-field-while-remote-reindexing/87931/3 "2017-06-27T05:35:43Z")

</div>

Here's my solution.

**Ingest Pipeline:**  
Created an ingest pipeline with ignore failures since the field is not present in every log line.

```
PUT _ingest/pipeline/remove-logmsg
{
  "description" : "Remove logmsg pipeline",
  "processors" : [
    {
      "remove" : {
        "field": "logmsg",
        "ignore_failure" : true
      }
    }
  ]
}

```

**Remote Reindex with ingest pipeline:**

```
curl -XPOST host_1:9200/_reindex?wait_for_completion=true -d'{
"source": {
  "remote": {
    "host": "http://host_2:9200"
  },
  "index": "logstash-2017.05.31",
  "query": {
    "match": {
      "type": "web-service"
    }
  }
},
"dest": {
  "index": "logstash-web-service-2017.05.31",
    "pipeline": "remove-logmsg"
}
}'
```

---

<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:** [July 25, 2017, 5:35am UTC](https://discuss.elastic.co/t/whats-best-way-to-drop-a-field-while-remote-reindexing/87931/4 "2017-07-25T05:35:46Z")

</div>

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