Bird
0
0

You tried to index a document with this JSON:

medium📝 Debug Q14 of 15
Elasticsearch - Document Operations
You tried to index a document with this JSON:
{ "index": "users", "id": "u123", "body": { "name": "Bob" } }

But the document was not saved with ID "u123". What is the likely problem?
AThe "body" field is missing required fields.
BThe index name "users" is invalid.
CThe field "id" should be "_id" to set manual ID.
DManual IDs are not allowed in Elasticsearch.
Step-by-Step Solution
Solution:
  1. Step 1: Check the ID field name

    Elasticsearch requires "_id" (with underscore) to specify manual IDs, not "id".
  2. Step 2: Confirm impact of wrong field

    Using "id" means Elasticsearch ignores it and generates an automatic ID instead.
  3. Final Answer:

    The field "id" should be "_id" to set manual ID. -> Option C
  4. Quick Check:

    Manual ID needs "_id", not "id" [OK]
Quick Trick: Use "_id" to set manual ID, not "id" [OK]
Common Mistakes:
MISTAKES
  • Using "id" instead of "_id"
  • Assuming missing fields cause ID issues
  • Thinking manual IDs are disallowed

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Elasticsearch Quizzes