0
0
Elasticsearchquery~10 mins

Indexing a document (POST/PUT) 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 index a document using POST method.

Elasticsearch
POST /my_index/_doc/[1]
{
  "title": "Learn Elasticsearch",
  "content": "Elasticsearch is a search engine"
}
Drag options to blanks, or click blank then click option'
A_update
B_search
C1
D_delete
Attempts:
3 left
💡 Hint
Common Mistakes
Using _search or _update instead of a document ID.
Omitting the document ID when required.
2fill in blank
medium

Complete the code to index a document using PUT method with a specific ID.

Elasticsearch
PUT /my_index/_doc/[1]
{
  "user": "alice",
  "message": "Hello Elasticsearch"
}
Drag options to blanks, or click blank then click option'
A_update
B2
C_search
D_delete
Attempts:
3 left
💡 Hint
Common Mistakes
Using action keywords instead of an ID.
Confusing PUT with POST endpoints.
3fill in blank
hard

Fix the error in the code to correctly index a document with ID 3.

Elasticsearch
POST /my_index/_doc/[1]
{
  "name": "Bob",
  "age": 30
}
Drag options to blanks, or click blank then click option'
A_update
B_bulk
C_search
D3
Attempts:
3 left
💡 Hint
Common Mistakes
Using _update or _search instead of the document ID.
Missing the document ID in the URL.
4fill in blank
hard

Fill both blanks to index a document with ID 4 and specify the index name.

Elasticsearch
[1] /[2]/_doc/4
{
  "title": "Elasticsearch Basics",
  "tags": ["search", "database"]
}
Drag options to blanks, or click blank then click option'
APUT
Bmy_index
CPOST
Dusers
Attempts:
3 left
💡 Hint
Common Mistakes
Using POST instead of PUT for a specific document ID.
Using wrong index name.
5fill in blank
hard

Fill all three blanks to index a document with ID 5 in the 'blog' index using POST method.

Elasticsearch
[1] /[2]/[3]/5
{
  "author": "Jane",
  "content": "Elasticsearch tutorial"
}
Drag options to blanks, or click blank then click option'
A_doc
Bblog
DPOST
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up HTTP method and URL parts.
Using wrong index or type names.