Complete the code to retrieve a document by its ID using Elasticsearch's GET API.
GET /my_index/_doc/[1]The GET API requires the document ID to retrieve the specific document. Here, '123' is the document ID.
Complete the JSON body to retrieve a document by ID using the Elasticsearch _search API with a term query.
{
"query": {
"term": { "_id": "[1]" }
}
}The term query on '_id' requires the exact document ID, such as 'user_1'.
Fix the error in the code to correctly retrieve a document by ID using the Elasticsearch Python client.
response = client.get(index="products", id=[1])
The document ID must be a string, so it needs quotes around it like "abc123".
Fill both blanks to complete the curl command that retrieves a document by ID from Elasticsearch.
curl -X [1] "http://localhost:9200/[2]/_doc/42"
The GET method is used to retrieve documents, and 'my_index' is the index name.
Fill all three blanks to complete the Elasticsearch query that retrieves a document by ID using the REST API with a JSON body.
{
"query": {
"[1]": {
"[2]": "[3]"
}
}
}The 'term' query is used for exact matches, '_id' specifies the document ID field, and 'doc_789' is the document ID.