Search in the same structure

Good afternoon,

Someone could help me please to do a search inside a structure? Now I will explain me better sorry:

I have this mapping:

 "idiomesNivell": {
            "properties": {
              "nivellIdioma": {
                "type": "long"
              },
              "nomIdioma": {
                "type": "text",
                "fields": {
                  "keyword": {
                    "type": "keyword",
                    "ignore_above": 256
                  }
                }
              }
            }
          }

Now my query is searching in a differents levels:

GET treballadors_catal/_search
{
  "from": 0,
  "size": 300,
  "query": {
    "bool": {
      "must": [
        {
          "terms": {
            "idiomesNivell.nomIdioma.keyword": [
              "Anglès"
            ]
          }
        },
        {
          "range": {
            "idiomesNivell.nivellIdioma": {
              "gte": "5",
              "lte": "5"
            }
          }
        }
      ]
    }
  }
}

My intention is search one document that in the same level have nivellIdioma 5 AND nomIdioma "Angles", is possible? Now I have these incorrect results for example:


"idiomesNivell": [
            {
              "nivellIdioma": 2,
              "nomIdioma": "**Anglès**"
            },
            {
              "nivellIdioma": **5**,
              "nomIdioma": "Català"
            }
          ]

Thanks for the help

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.