# Use filter specified in json through java API

**URL:** <https://discuss.elastic.co/t/use-filter-specified-in-json-through-java-api/23159>\
**Category:** Elasticsearch\
**Created:** [April 8, 2015, 10:16pm UTC](https://discuss.elastic.co/t/use-filter-specified-in-json-through-java-api/23159 "2015-04-08T22:16:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![prateek](https://avatars.discourse-cdn.com/v4/letter/p/ee7513/32.png) [@prateek](https://discuss.elastic.co/u/prateek)\
**Post date:** [April 8, 2015, 10:16pm UTC](https://discuss.elastic.co/t/use-filter-specified-in-json-through-java-api/23159/1 "2015-04-08T22:16:37Z")

</div>

I am having requirement where in I need to use filter specified in json  
through elasticsearch Java API.

for example below elasticsearch json filter needs to be used through Java  
API:  
"filter" : {  
"bool" : {  
"should" : [  
{ "term" : {"productID" : "KDKE-B-9947-#kL5"}},  
{ "bool" : {  
"must" : [  
{ "term" : {"productID" : "JODL-X-1937-#pV7"}},  
{ "term" : {"price" : 30}}  
]  
}}  
]  
}  
}

How would I go about it?

I have written my own builder/converter that achieves the above. But if  
there are pre-existing options, then I would look to explore them.

Thanks.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/563e7855-a2bd-45f9-9ad9-f6c04811996f%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/563e7855-a2bd-45f9-9ad9-f6c04811996f%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![prateek](https://avatars.discourse-cdn.com/v4/letter/p/ee7513/32.png) [@prateek](https://discuss.elastic.co/u/prateek)\
**Post date:** [April 8, 2015, 11:11pm UTC](https://discuss.elastic.co/t/use-filter-specified-in-json-through-java-api/23159/2 "2015-04-08T23:11:38Z")

</div>

Or you could say that I need convert request specified in json format  
through java API.

On Wednesday, April 8, 2015 at 3:16:37 PM UTC-7, Prateek Asthana wrote:

> I am having requirement where in I need to use filter specified in json  
> through elasticsearch Java API.
> 
> for example below elasticsearch json filter needs to be used through Java  
> API:  
> "filter" : {  
> "bool" : {  
> "should" : [  
> { "term" : {"productID" : "KDKE-B-9947-#kL5"}},  
> { "bool" : {  
> "must" : [  
> { "term" : {"productID" : "JODL-X-1937-#pV7"}},  
> { "term" : {"price" : 30}}  
> ]  
> }}  
> ]  
> }  
> }
> 
> How would I go about it?
> 
> I have written my own builder/converter that achieves the above. But if  
> there are pre-existing options, then I would look to explore them.
> 
> Thanks.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/06222ffe-c46b-4a2a-9230-2f8c20d0d0dc%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/06222ffe-c46b-4a2a-9230-2f8c20d0d0dc%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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 6, 2017, 12:20am UTC](https://discuss.elastic.co/t/use-filter-specified-in-json-through-java-api/23159/3 "2017-07-06T00:20:43Z")

</div>


