# How to filter a field values by 'contains' term

**URL:** <https://discuss.elastic.co/t/how-to-filter-a-field-values-by-contains-term/208629>\
**Category:** Kibana\
**Created:** [November 20, 2019, 6:52am UTC](https://discuss.elastic.co/t/how-to-filter-a-field-values-by-contains-term/208629 "2019-11-20T06:52:10Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![nimrod](https://avatars.discourse-cdn.com/v4/letter/n/ed8c4c/32.png) [@nimrod](https://discuss.elastic.co/u/nimrod)\
**Post date:** [November 20, 2019, 6:52am UTC](https://discuss.elastic.co/t/how-to-filter-a-field-values-by-contains-term/208629/1 "2019-11-20T06:52:10Z")

</div>

I want to filter out the results by getting all results which their 'testClass' field contains the 'policymanager.ui.common.RulesPageTests' package name.

Is there any way querying the results out?

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/0/c/0c7f248410c4b0e3c77867c10220968c1dd31b93.png)

---

<div class="post-metadata">

**Author:** ![Larry\_Gregory](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/larry_gregory/32/34969_2.png) [@Larry\_Gregory](https://discuss.elastic.co/u/Larry_Gregory)\
**Post date:** [November 21, 2019, 4:24pm UTC](https://discuss.elastic.co/t/how-to-filter-a-field-values-by-contains-term/208629/2 "2019-11-21T16:24:51Z")

</div>

Hey @nimrod, welcome to the discussion boards!

Can you try the following in the query bar:

`NOT testClass: policymanager.ui.common.RulesPageTests*`

---

<div class="post-metadata">

**Author:** ![nimrod](https://avatars.discourse-cdn.com/v4/letter/n/ed8c4c/32.png) [@nimrod](https://discuss.elastic.co/u/nimrod)\
**Post date:** [November 24, 2019, 5:39am UTC](https://discuss.elastic.co/t/how-to-filter-a-field-values-by-contains-term/208629/3 "2019-11-24T05:39:19Z")

</div>

> [@Larry\_Gregory](#):
>
> NOT testClass: policymanager.ui.common.RulesPageTests\*

Hi Larry, thanks!  
But it still won't filter out the 'policymanager.ui.common.RulesPageTests' package name.. (I'm getting much more irrelevant results) is it possible this kind of query is not supported?

---

<div class="post-metadata">

**Author:** ![Larry\_Gregory](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/larry_gregory/32/34969_2.png) [@Larry\_Gregory](https://discuss.elastic.co/u/Larry_Gregory)\
**Post date:** [November 26, 2019, 12:59pm UTC](https://discuss.elastic.co/t/how-to-filter-a-field-values-by-contains-term/208629/4 "2019-11-26T12:59:54Z")

</div>

hmmm...

After running the query, can you click on the "Inspect" link on the top left of Discover, and then copy the contents of the "Request" tab of the flyout that appears here?

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1aa4445418cc8430feb60446096dc2975b62ac05.png)

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/e/5/e53d928da4f400fee996f6eeb3b3a8e15fa0f660.png)

---

<div class="post-metadata">

**Author:** ![nimrod](https://avatars.discourse-cdn.com/v4/letter/n/ed8c4c/32.png) [@nimrod](https://discuss.elastic.co/u/nimrod)\
**Post date:** [November 26, 2019, 1:18pm UTC](https://discuss.elastic.co/t/how-to-filter-a-field-values-by-contains-term/208629/5 "2019-11-26T13:18:33Z")

</div>

> [@nimrod](#):
>
> NOT testClass: policymanager.ui.common.RulesPageTests\*

Hi Larry - I including the request content:

{  
"version": true,  
"size": 500,  
"sort": [  
{  
"startTime": {  
"order": "desc",  
"unmapped\_type": "boolean"  
}  
}  
],  
"\_source": {  
"excludes":   
},  
"aggs": {  
"2": {  
"date\_histogram": {  
"field": "startTime",  
"interval": "5m",  
"time\_zone": "Asia/Jerusalem",  
"min\_doc\_count": 1  
}  
}  
},  
"stored\_fields": [  
"_"  
],  
"script\_fields": {},  
"docvalue\_fields": [  
{  
"field": "startTime",  
"format": "date\_time"  
}  
],  
"query": {  
"bool": {  
"must": [  
{  
"range": {  
"startTime": {  
"format": "strict\_date\_optional\_time",  
"gte": "2019-11-26T10:16:43.146Z",  
"lte": "2019-11-26T13:16:43.146Z"  
}  
}  
}  
],  
"filter": [  
{  
"bool": {  
"must\_not": {  
"bool": {  
"should": [  
{  
"query\_string": {  
"fields": [  
"testClass"  
],  
"query": "policymanager\.ui\.common\.RulesPageTests_"  
}  
}  
],  
"minimum\_should\_match": 1  
}  
}  
}  
}  
],  
"should": ,  
"must\_not":   
}  
},  
"highlight": {  
"pre\_tags": [  
"@kibana-highlighted-field@"  
],  
"post\_tags": [  
"@/kibana-highlighted-field@"  
],  
"fields": {  
"\*": {}  
},  
"fragment\_size": 2147483647  
}  
}

---

<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:** [December 24, 2019, 1:18pm UTC](https://discuss.elastic.co/t/how-to-filter-a-field-values-by-contains-term/208629/6 "2019-12-24T13:18:43Z")

</div>

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