Complete the code to index a document with an automatic ID in Elasticsearch.
client.index(index='products', body=[1])
When indexing a document without specifying an ID, Elasticsearch generates an automatic ID. The document body should be passed as the body parameter.
Complete the code to index a document with a manual ID 'abc123' in Elasticsearch.
client.index(index='products', id=[1], body={'name': 'Phone', 'price': 800})
To specify a manual document ID, pass it as a string to the id parameter.
Fix the error in the code to update a document with manual ID 'xyz789' in Elasticsearch.
client.update(index='products', id=[1], body={'doc': {'price': 950}})
The id parameter must be a string matching the manual document ID. Without quotes, it is treated as a variable causing an error.
Fill both blanks to delete a document with manual ID 'doc456' from the 'orders' index.
client.delete(index=[1], id=[2])
To delete a document, specify the index name and the manual document ID as strings.
Fill all three blanks to search documents in 'customers' index where 'age' is greater than 30.
client.search(index=[1], body={'query': {'range': {'age': {'gt': [2], size=[3])
The search query specifies the index name, the age threshold as a number, and the number of results to return.