# Filter by any field

**URL:** https://discuss.elastic.co/t/filter-by-any-field/179940
**Category:** Elasticsearch
**Created:** [May 7, 2019, 11:03am UTC](https://discuss.elastic.co/t/filter-by-any-field/179940 "2019-05-07T11:03:09Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![vijayaraj](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vijayaraj/32/108105_2.png) [@vijayaraj](https://discuss.elastic.co/u/vijayaraj)
#### Post date: [May 7, 2019, 11:03am UTC](https://discuss.elastic.co/t/filter-by-any-field/179940/1 "2019-05-07T11:03:09Z")

</div>

I have an elasticsearch Document that has around 15 fields.  
I should be able to target every field for filtering.

But sometimes, I need to filter documents by CategoryName and MerchantID,  
While other time I need to filter documents by CategoryID and Price. etc

I have written a query packing all the 15 fields.

If I don't provide values for the remaining 13 fields it throws an error saying value missing.  
Is there any methodology in elasticsearch that would make the behaviour dynamic??

---

<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: [June 4, 2019, 11:16am UTC](https://discuss.elastic.co/t/filter-by-any-field/179940/2 "2019-06-04T11:16:58Z")

</div>

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