Given the following Elasticsearch reindex API request, what will be the value of response['created'] after the task completes successfully?
{
"source": {"index": "old_index"},
"dest": {"index": "new_index"}
}
// Assume old_index has 100 documents and no errors occur.Reindexing copies documents from source to destination. The created field shows how many documents were added.
The created field in the response indicates how many documents were successfully reindexed. Since the source index has 100 documents and no errors occur, created will be 100.
What does setting wait_for_completion to false do when running a reindex task?
Think about how asynchronous tasks work in Elasticsearch.
Setting wait_for_completion to false makes the reindex API return immediately with a task ID, allowing the task to run in the background.
Consider this reindex request:
{
"source": {"index": "source_index"},
"dest": {"index": "dest_index", "op_type": "create"}
}Both indices have documents with overlapping IDs. What causes the error?
Check what op_type: create means in Elasticsearch indexing.
The op_type: create option tells Elasticsearch to only create documents if they don't exist. If a document with the same ID exists in the destination, a version conflict error occurs.
Choose the valid reindex request that adds a new field status with value archived to each document.
Check the correct key for the script source in Elasticsearch reindex API.
The correct key for the script source in recent Elasticsearch versions is source. Using inline or code is deprecated or invalid in this context.
You want to reindex documents from users index to users_archive index. Only documents with status equal to active should be copied. Also, add or update a field last_updated with the current date during reindexing.
Which request accomplishes this?
Painless scripts support Instant.now() for current time. Avoid JavaScript-like syntax or invalid placeholders.
Option D correctly filters documents with a term query and sets last_updated to the current time using Instant.now(), which is supported in Painless scripts. Option D uses an invalid placeholder {{ctx.execution_time}}. Option D uses unsupported new Date() and a less precise match query. Option D uses a fixed date instead of the current date.