Use ElasticSearch API to provide json filter

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
"filter" : {
"bool" : {
"should" : [
{ "term" : {"productID" : "KDKE-B-9947-#kL5"}},
{ "bool" : {
"must" : [
{ "term" : {"productID" : "JODL-X-1937-#pV7"}},
{ "term" : {"price" : 30}}

I have explored SearchRequestBuilder.setExtraSource and
SearchRequestBuilder.setSearchType but they do not solve the above issue.
How would I go about it?


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
To view this discussion on the web visit
For more options, visit