Complete the code to create an index named 'products'.
PUT /[1]The index name 'products' is used to organize product data in Elasticsearch.
Complete the code to add a document with ID '1' to the 'products' index.
PUT /products/_doc/[1] { "name": "Laptop", "price": 1200 }
The document ID '1' uniquely identifies this product in the 'products' index.
Fix the error in the query to search for products with price less than 1500.
{
"query": {
"range": {
"price": { "[1]": 1500 }
}
}
}The 'lt' operator means 'less than', which matches products priced below 1500.
Fill the blank to create an index with a mapping that sets 'price' as a double type.
PUT /products
{
"mappings": {
"properties": {
"price": { "type": "[1]" }
}
}
}The 'double' type is used for decimal numbers like prices.
Fill all three blanks to write a query that finds products with name 'Laptop' and price greater than 1000.
{
"query": {
"bool": {
"must": [
{ "match": { "name": "[1]" } },
{ "range": { "price": { "[2]": [3] } } }
]
}
}
}This query matches documents where the name is 'Laptop' and the price is greater than 1000.