# In Kibana vega can we give index pattern with filters in data source

**URL:** <https://discuss.elastic.co/t/in-kibana-vega-can-we-give-index-pattern-with-filters-in-data-source/292243>\
**Category:** Kibana\
**Tags:** vega\
**Created:** [December 17, 2021, 1:38am UTC](https://discuss.elastic.co/t/in-kibana-vega-can-we-give-index-pattern-with-filters-in-data-source/292243 "2021-12-17T01:38:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![chandima\_jayamina](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chandima_jayamina/32/99168_2.png) [@chandima\_jayamina](https://discuss.elastic.co/u/chandima_jayamina)\
**Post date:** [December 17, 2021, 1:38am UTC](https://discuss.elastic.co/t/in-kibana-vega-can-we-give-index-pattern-with-filters-in-data-source/292243/1 "2021-12-17T01:38:15Z")

</div>

Hi I have to show all the data on index pattern with some filters. In discover I have school and I want to filter out all the students in grade 5. When I add the filter and see in discover it has 6000 records. But all records are more than 15k (Without filters). So in vega can i load the data source as index pattern with filters. Eg - index : 'school\_system\* {filter grade 5}'

```auto
data [
       "name" : "Grade5Students",
       "url" : {
             "index" : "school-system*" // I want to add filter as grade.keyword:5
       }
]

```

Because in vega it does not load more than 10k records. So i was wonder we can get by filtering in dex pattern or do the filter before loading all data. Multiple index pattens is not solution for my current one.

---

<div class="post-metadata">

**Author:** ![aaron-nimocks](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aaron-nimocks/32/73965_2.png) [@aaron-nimocks](https://discuss.elastic.co/u/aaron-nimocks)\
**Post date:** [December 17, 2021, 12:09pm UTC](https://discuss.elastic.co/t/in-kibana-vega-can-we-give-index-pattern-with-filters-in-data-source/292243/2 "2021-12-17T12:09:50Z")

</div>

You can add a [body and do any query or any aggregation](https://www.elastic.co/guide/en/kibana/current/vega.html#vega-queries) that you want to shape the data before pulling it into Vega.

```auto
"name" : "Grade5Students",
"url" : {
 "index" : "school-system*",
 "body": {"query": {"bool": {"filter": [{"term": {"grade.keyword": 5}}]}}}
}

```

---

<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 14, 2022, 12:10pm UTC](https://discuss.elastic.co/t/in-kibana-vega-can-we-give-index-pattern-with-filters-in-data-source/292243/3 "2022-01-14T12:10:10Z")

</div>

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