0
0
Elasticsearchquery~10 mins

Reindexing data in Elasticsearch - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to start reindexing from source to destination index.

Elasticsearch
{
  "source": { "index": "[1]" },
  "dest": { "index": "new_index" }
}
Drag options to blanks, or click blank then click option'
Aold_index
Bnew_index
Csource_index
Ddest_index
Attempts:
3 left
💡 Hint
Common Mistakes
Using the destination index name as the source index.
Using a non-existent index name.
2fill in blank
medium

Complete the code to add a query filter to reindex only documents where status is 'active'.

Elasticsearch
{
  "source": {
    "index": "old_index",
    "query": { "term": { "status": "[1]" } }
  },
  "dest": { "index": "new_index" }
}
Drag options to blanks, or click blank then click option'
Apending
Binactive
Cactive
Ddeleted
Attempts:
3 left
💡 Hint
Common Mistakes
Using a status value that does not exist in documents.
Using a query type other than term for exact match.
3fill in blank
hard

Fix the error in the reindex request by completing the missing field for the destination index.

Elasticsearch
{
  "source": { "index": "old_index" },
  "dest": { "[1]": "new_index" }
}
Drag options to blanks, or click blank then click option'
Asource
Bindex
Cquery
Dtype
Attempts:
3 left
💡 Hint
Common Mistakes
Using source instead of index in destination.
Omitting the destination index field.
4fill in blank
hard

Fill both blanks to reindex documents from 'old_index' to 'new_index' with a script that sets the field 'status' to 'archived'.

Elasticsearch
{
  "source": { "index": "[1]" },
  "dest": { "index": "[2]" },
  "script": {
    "source": "ctx._source.status = 'archived'"
  }
}
Drag options to blanks, or click blank then click option'
Aold_index
Bnew_index
Carchive_index
Dsource_index
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping source and destination index names.
Using an incorrect index name.
5fill in blank
hard

Fill all three blanks to reindex documents from 'products' to 'products_new' only if 'price' is greater than 100, and add a script to increase 'price' by 10%.

Elasticsearch
{
  "source": {
    "index": "[1]",
    "query": { "range": { "price": { "[2]": 100 } } }
  },
  "dest": { "index": "[3]" },
  "script": {
    "source": "ctx._source.price *= 1.1"
  }
}
Drag options to blanks, or click blank then click option'
Aproducts
Bgt
Cproducts_new
Dgte
Attempts:
3 left
💡 Hint
Common Mistakes
Using gte instead of gt.
Mixing up source and destination index names.