# Can Curator filters documents during reindexation?

**URL:** <https://discuss.elastic.co/t/can-curator-filters-documents-during-reindexation/131758>\
**Category:** Elastic Community and Ecosystem\
**Created:** [May 14, 2018, 2:33pm UTC](https://discuss.elastic.co/t/can-curator-filters-documents-during-reindexation/131758 "2018-05-14T14:33:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![fbonningues](https://avatars.discourse-cdn.com/v4/letter/f/e9a140/32.png) [@fbonningues](https://discuss.elastic.co/u/fbonningues)\
**Post date:** [May 14, 2018, 2:33pm UTC](https://discuss.elastic.co/t/can-curator-filters-documents-during-reindexation/131758/1 "2018-05-14T14:33:32Z")

</div>

Hi,

I'm using curator for reindex daily indices into weekly/montly indices and it's work fine.

The current treatment takes all the documents and create the new index, but can curator excludes some documents (filter on a field value) or deletes some fields of a document ?

I managed to reindex with deletion of these specific documents/fields by the \_reindex API, but I 'ld rather use curator to make this action.

Thanks for the answer  
Best regards

François

---

<div class="post-metadata">

**Author:** ![theuntergeek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/theuntergeek/32/44961_2.png) [@theuntergeek](https://discuss.elastic.co/u/theuntergeek)\
**Post date:** [May 14, 2018, 3:32pm UTC](https://discuss.elastic.co/t/can-curator-filters-documents-during-reindexation/131758/2 "2018-05-14T15:32:14Z")

</div>

The answer to this is a resounding [yes](https://www.elastic.co/guide/en/elasticsearch/reference/6.2/docs-reindex.html#docs-reindex). Curator just uses YAML syntax to do anything that you can do with the regular [reindex API](https://www.elastic.co/guide/en/elasticsearch/reference/6.2/docs-reindex.html#docs-reindex).

For example, given this JSON reindex block:

```json
POST _reindex
{
  "source": {
    "index": "twitter",
    "type": "_doc",
    "query": {
      "term": {
        "user": "kimchy"
      }
    }
  },
  "dest": {
    "index": "new_twitter"
  }
}

```

You would create a YAML [`request_body`](https://www.elastic.co/guide/en/elasticsearch/client/curator/5.5/option_request_body.html#_manual_index_selection) like this:

```auto
request_body:
  source:
    index: twitter
    type: _doc
    query:
      term:
        user: kimchy
  dest:
    index: new_twitter

```

---

<div class="post-metadata">

**Author:** ![fbonningues](https://avatars.discourse-cdn.com/v4/letter/f/e9a140/32.png) [@fbonningues](https://discuss.elastic.co/u/fbonningues)\
**Post date:** [May 14, 2018, 3:34pm UTC](https://discuss.elastic.co/t/can-curator-filters-documents-during-reindexation/131758/3 "2018-05-14T15:34:15Z")

</div>

Thanks a lot !

---

<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:** [June 11, 2018, 3:34pm UTC](https://discuss.elastic.co/t/can-curator-filters-documents-during-reindexation/131758/4 "2018-06-11T15:34:17Z")

</div>

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