1

Here is the simple usecase,

I have a system that sends the Lucene query to my elastic search. I have a mapping

{
"mappings": {
    "properties": {
      "grocery_name":{
        "type": "text"
       },
      "items": {
        "type": "nested",
        "properties": {
          "name": {
            "type": "text"
          },
          "stock": {
            "type": "integer"
          },
          "category": {
            "type": "text"
          }
        }
      }
    }
  }
}

and the data looks like

{
  "grocery_name": "Elastic Eats",
  "items": [
    {
      "name": "banana",
      "stock": "12",
      "category": "fruit"
    },
    {
      "name": "peach",
      "stock": "10",
      "category": "fruit"
    },
    {
      "name": "carrot",
      "stock": "9",
      "category": "vegetable"
    },
    {
      "name": "broccoli",
      "stock": "5",
      "category": "vegetable"
    }
  ]
}

How can I query to get all items where the item name is banana and stock > 10, In KQL i can write something like items:{ name:banana and stock > 10 }

0

1 Answer 1

1

The Lucene expression language doesn't support querying nested documents. That's why the KQL language fills that gap.

That's currently the only way to query nested documents via the Kibana search bar.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.