# Include/exclude specific fields

**URL:** <https://discuss.elastic.co/t/include-exclude-specific-fields/336817>\
**Category:** Elasticsearch\
**Created:** [June 24, 2023, 4:28pm UTC](https://discuss.elastic.co/t/include-exclude-specific-fields/336817 "2023-06-24T16:28:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Itay\_Bittan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/itay_bittan/32/23527_2.png) [@Itay\_Bittan](https://discuss.elastic.co/u/Itay_Bittan)\
**Post date:** [June 24, 2023, 4:28pm UTC](https://discuss.elastic.co/t/include-exclude-specific-fields/336817/1 "2023-06-24T16:28:39Z")

</div>

My index's documents looks like that:

```auto
{
        "sku": "1234567890",
        "name": "my_name",
        "lng:en_AE:name": "my_name_in_AE",
        "lng:en_AE:price": 10.99,
        "lng:en_BH:name": "my_name_in_BH",
        "lng:en_BH:price": 9.99,
        "lng:en_QA:name": "my_name_in_QA",
        "lng:en_QA:price": 8.99,
    }

```

There are two "types" of fields:

1. general/global - like `"sku"`, `"name"`.
2. language based fields, start with perfix: `lng:xx_YY:*` - like `"lng:en_AE:name"`.

A user can add his own fields, either general/global ones or language specific.

When we search for the documents, we want to get all general/global fields and one specific language fields:

```auto
{
  "_source": {
        "includes": [
          "lng:en_AE:*",
          "*"
        ],
    "excludes": [
        "lng:*"
    ]
  }
}

```

The query about doesn't work but my intent was the get exclude all languages different than `en_AE`. I don't know all `lng` possibilities in advance and I can't change the schema, is there a way to achieve that?  
I would like to get that as a response:

```auto
{
        "sku": "1234567890",
        "name": "my_name",
        "lng:en_AE:name": "my_name_in_AE",
        "lng:en_AE:price": 10.99,
    }

```

---

<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:** [July 22, 2023, 4:29pm UTC](https://discuss.elastic.co/t/include-exclude-specific-fields/336817/2 "2023-07-22T16:29:35Z")

</div>

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