# How to return data that has particular columns in every \_source dictionary in Elasticsearch?

**URL:** <https://discuss.elastic.co/t/how-to-return-data-that-has-particular-columns-in-every-source-dictionary-in-elasticsearch/300680>\
**Category:** Elasticsearch\
**Created:** [March 25, 2022, 9:37am UTC](https://discuss.elastic.co/t/how-to-return-data-that-has-particular-columns-in-every-source-dictionary-in-elasticsearch/300680 "2022-03-25T09:37:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Harish\_fragger](https://avatars.discourse-cdn.com/v4/letter/h/edb3f5/32.png) [@Harish\_fragger](https://discuss.elastic.co/u/Harish_fragger)\
**Post date:** [March 25, 2022, 9:37am UTC](https://discuss.elastic.co/t/how-to-return-data-that-has-particular-columns-in-every-source-dictionary-in-elasticsearch/300680/1 "2022-03-25T09:37:02Z")

</div>

I have an Elasticsearch query which is extracting data from the following fields `"_source": ["data.service","data.vpn","data.policyid","data.srccountry1"]` . While using the search function which gives only max hits of 10,000 I observe that in a lot of hits all \_source values are not present.

Query :

```auto
{ 
"size" : 10000,
"_source": "_source": ["data.service","data.vpn","data.policyid","data.srccountry1"], 
      "query":{
        "bool": {
          "must": [
            {"match_phrase": {"data.action": "accept"}},
            {"match_phrase": {"location": "192.168.0.1"}}
          ]
        }
      }
    }

```

In some of the hits `data.vpn` is not present or `data.srccountry1` is not present. How can I write a query where I need the hits to have all the `_source field` values?

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [March 25, 2022, 10:41am UTC](https://discuss.elastic.co/t/how-to-return-data-that-has-particular-columns-in-every-source-dictionary-in-elasticsearch/300680/2 "2022-03-25T10:41:50Z")

</div>

Have you tried adding a few [exists query clauses](https://www.elastic.co/guide/en/elasticsearch/reference/8.1/query-dsl-exists-query.html) to your list of conditions?

---

<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:** [April 22, 2022, 10:41am UTC](https://discuss.elastic.co/t/how-to-return-data-that-has-particular-columns-in-every-source-dictionary-in-elasticsearch/300680/3 "2022-04-22T10:41:52Z")

</div>

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