Bird
0
0

You wrote this mapping for a nested field:

medium📝 Debug Q14 of 15
Elasticsearch - Mappings and Data Types
You wrote this mapping for a nested field:
{ "properties": { "tags": { "type": "nested", "properties": { "name": { "type": "keyword" } } } } }

But your nested query returns no results even though documents have matching tags. What is the likely mistake?
AYou forgot to use a nested query; used a regular bool query instead.
BYou defined tags as object type instead of nested.
CYou used match query on keyword field instead of term query.
DYou indexed tags as text instead of keyword.
Step-by-Step Solution
Solution:
  1. Step 1: Check mapping correctness

    The mapping correctly defines "tags" as nested with keyword "name" field, so mapping is fine.
  2. Step 2: Identify query mistake

    If nested query returns no results, often the cause is using a regular bool query instead of a nested query to search nested fields, losing the link between nested objects.
  3. Final Answer:

    You forgot to use a nested query; used a regular bool query instead. -> Option A
  4. Quick Check:

    Nested fields require nested queries [OK]
Quick Trick: Always use nested query for nested fields [OK]
Common Mistakes:
MISTAKES
  • Using bool query without nested for nested fields
  • Confusing object and nested types in mapping
  • Using match query on keyword fields

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Elasticsearch Quizzes