# Search in the same structure

**URL:** <https://discuss.elastic.co/t/search-in-the-same-structure/161387>\
**Category:** Elasticsearch\
**Created:** [December 18, 2018, 5:40pm UTC](https://discuss.elastic.co/t/search-in-the-same-structure/161387 "2018-12-18T17:40:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kirtash](https://avatars.discourse-cdn.com/v4/letter/k/a8b319/32.png) [@Kirtash](https://discuss.elastic.co/u/Kirtash)\
**Post date:** [December 18, 2018, 5:40pm UTC](https://discuss.elastic.co/t/search-in-the-same-structure/161387/1 "2018-12-18T17:40:31Z")

</div>

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:

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

```

Now my query is searching in a differents levels:

```auto
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:

```auto

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

```

Thanks for the help

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [January 15, 2019, 5:40pm UTC](https://discuss.elastic.co/t/search-in-the-same-structure/161387/2 "2019-01-15T17:40:31Z")

</div>

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