Change document data while reindexing documents

i'd like to know if there is a way to ignore some fields that contains specifics values while reindexing

Hi,

In other words you want to remove fields in the target index which are in the source index? While I haven't tried it out I guess this is what you want:

POST _reindex
{
  "source": {
    "index": "twitter",
    "_source": ["user", "_doc"]
  },
  "dest": {
    "index": "new_twitter"
  }
}

https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html#docs-reindex-filter-source

_source
(Optional, string) If true reindexes all source fields. Set to a list to reindex select fields. Defaults to true .

Best regards
Wolfram

Hi ,
i want to ignore fields based on their value , for example if date field has a specific value in the source index i'd like to put a new value for the date in the target index

Hi,

If you want to do that based on the value this is not the correct way for you. Instead, you can use a script to modify the documents before writing them to the new index:
https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html#reindex-scripts

Best regards
Wolfram

1 Like

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