Given an Elasticsearch index named products with documents containing fields name and price, what will this query return?
{
"query": {
"range": {
"price": {
"gte": 100,
"lte": 200
}
}
}
}Look at the range query and the meaning of gte and lte.
The range query filters documents where the price field is greater than or equal to 100 and less than or equal to 200.
Choose the best explanation for why Elasticsearch organizes data into indexes.
Think about how indexes help find data fast.
Indexes in Elasticsearch organize data so searches can quickly find matching documents without scanning everything.
Given this mapping snippet, what error will Elasticsearch raise?
{
"mappings": {
"properties": {
"price": {
"type": "text"
}
}
}
}Assuming price should be a number.
Consider the data type mismatch impact on queries.
Mapping price as text means numeric range queries on price will fail or behave incorrectly.
Choose the correct JSON to create an Elasticsearch index with a category field of type keyword.
Check the correct key names for mappings and properties.
The correct structure uses mappings with properties containing the field name and its type.
You create an Elasticsearch index with this command:
PUT /my_index
{
"settings": {
"number_of_shards": 3,
"number_of_replicas": 2
}
}How many primary shards and total shards will this index have?
Total shards = primary shards + (primary shards × replicas).
With 3 primary shards and 2 replicas each, total shards = 3 + (3×2) = 9 shards. But replicas are copies, so total shards = 3 primary + 6 replicas = 9 total shards.