What will happen if you try to search for documents with name containing partial words?
medium
A. Partial word matches will work because keyword fields support full-text search
B. Partial word matches will not work because keyword fields are exact values
C. Elasticsearch will throw a syntax error
D. Partial word matches will work only if age is also searched
Solution
Step 1: Understand keyword field behavior
Keyword fields store exact values and do not support partial or full-text search.
Step 2: Analyze the search behavior for partial words
Since name is keyword type, partial matches will fail; only exact matches work.
Final Answer:
Partial word matches will not work because keyword fields are exact values -> Option B
Quick Check:
Keyword = exact match only [OK]
Hint: Keyword fields do exact matches only, no partial search [OK]
Common Mistakes:
Assuming keyword fields support partial matching
Expecting syntax errors from valid mappings
Confusing integer field with text search behavior
4. You defined this mapping:
{ "properties": { "date": { "type": "text" } } }
What is the problem with this mapping if you want to filter by date range?
medium
A. The field name "date" is reserved and cannot be used
B. There is no problem; text type works for date filtering
C. The type should be "date" to enable date range filtering
D. You must add "index": false to filter by date
Solution
Step 1: Identify the correct type for date fields
Date range filtering requires the field to be of type "date" in Elasticsearch.
Step 2: Check the given mapping type
The mapping uses "text" type, which is not suitable for date operations like range filtering.
Final Answer:
The type should be "date" to enable date range filtering -> Option C
Quick Check:
Date filtering needs type "date" [OK]
Hint: Use type "date" for date range filters [OK]
Common Mistakes:
Using text type for date fields
Thinking field names are reserved keywords
Adding index false disables searching, not filtering
5. You want to store a user's profile with fields: username (exact match), bio (full-text search), and signup_date (date range queries). Which mapping correctly defines these fields?
Username needs exact matches, so "keyword" is correct. Bio needs full-text search, so "text" is correct. Signup_date needs date range queries, so "date" is correct.