The query must be inside the source object to filter documents.
Step 2: Validate other parts
The match syntax is correct, and dest index name is valid.
Final Answer:
The query should be inside the "source" object -> Option A
Quick Check:
Put query inside source to filter during reindex [OK]
Hint: Put filters inside source, not at top level [OK]
Common Mistakes:
Placing query outside source object
Misunderstanding match query syntax
Thinking destination index name is invalid
5.
You want to reindex data from logs_2023 to logs_archive but only include documents where level is "error" and add a new field archived set to true. Which reindex request achieves this?
Step 1: Filter documents by level "error" inside source
The query with term filter must be inside the source object to select only error level logs.
Step 2: Add new field "archived" with value true via script
The script sets ctx._source.archived = true to add the new field during reindex.
Step 3: Validate requests
The request that places query inside source with term filter for level: "error" and script setting ctx._source.archived = true is correct. Placing query at top level is invalid. Using match instead of term or setting archived to false is incorrect.