# Java API: Search with QueryBuilder and FilterBuilder

**URL:** <https://discuss.elastic.co/t/java-api-search-with-querybuilder-and-filterbuilder/6552>\
**Category:** Elasticsearch\
**Created:** [January 31, 2012, 9:22am UTC](https://discuss.elastic.co/t/java-api-search-with-querybuilder-and-filterbuilder/6552 "2012-01-31T09:22:24Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ariel\_Mendoza](https://avatars.discourse-cdn.com/v4/letter/a/cc9497/32.png) [@Ariel\_Mendoza](https://discuss.elastic.co/u/Ariel_Mendoza)\
**Post date:** [January 31, 2012, 9:22am UTC](https://discuss.elastic.co/t/java-api-search-with-querybuilder-and-filterbuilder/6552/1 "2012-01-31T09:22:24Z")

</div>

I am using Java API for text search. Refer to the codes below, when I  
execute it, no record is retrieve though the Filter parameters of  
field and value pair I've set are correct, but when I comment-out or  
remove the .setFilter(fb), the search works fine. Please let me know  
if I'm doing this wrong or are there other approach to achieve my  
goal?

searchResponse = client.prepareSearch(dbName)  
.setSearchType(SearchType.QUERY\_THEN\_FETCH)  
.setQuery(qb)  
.setFilter(fb)  
.setVersion(true)  
.setFrom(start)  
.setSize(size)  
// .setExplain(true) // Explain hit score  
// .setNoFields() // Do not return  
stored fields  
.addField("document.title")  
.addField("document.desc")  
.execute()  
.actionGet();

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [January 31, 2012, 5:42pm UTC](https://discuss.elastic.co/t/java-api-search-with-querybuilder-and-filterbuilder/6552/2 "2012-01-31T17:42:21Z")

</div>

Really hard to help without knowing what filter you use, the data you index, and how its mapped...

On Tuesday, January 31, 2012 at 11:22 AM, Ariel Mendoza wrote:

> I am using Java API for text search. Refer to the codes below, when I  
> execute it, no record is retrieve though the Filter parameters of  
> field and value pair I've set are correct, but when I comment-out or  
> remove the .setFilter(fb), the search works fine. Please let me know  
> if I'm doing this wrong or are there other approach to achieve my  
> goal?
> 
> searchResponse = client.prepareSearch(dbName)  
> .setSearchType(SearchType.QUERY\_THEN\_FETCH)  
> .setQuery(qb)  
> .setFilter(fb)  
> .setVersion(true)  
> .setFrom(start)  
> .setSize(size)  
> // .setExplain(true) // Explain hit score  
> // .setNoFields() // Do not return  
> stored fields  
> .addField("document.title")  
> .addField("document.desc")  
> .execute()  
> .actionGet();

---

<div class="post-metadata">

**Author:** ![Ariel\_Mendoza](https://avatars.discourse-cdn.com/v4/letter/a/cc9497/32.png) [@Ariel\_Mendoza](https://discuss.elastic.co/u/Ariel_Mendoza)\
**Post date:** [February 1, 2012, 12:35am UTC](https://discuss.elastic.co/t/java-api-search-with-querybuilder-and-filterbuilder/6552/3 "2012-02-01T00:35:45Z")

</div>

Hi Shay,

I am using AndFilterBuilder. Here are the results when setFilter(fb)  
is commented-out.

Search 'Person': took 68ms, shards 1:0  
hit: 0.220823 test\_db1/template/CrmPerson(ver 1)  
hit: 0.220823 test\_db1/template/CrmCompany(ver 1)  
hit: 0.126185 test\_db1/Person/W2.7(ver 1)  
hit: 0.126185 test\_db1/Person/W2.8(ver 1)  
hit: 0.126185 test\_db1/Person/W2.9(ver 1)  
hit: 0.126185 test\_db1/Person/W2.10(ver 1)  
hit: 0.126185 test\_db1/Person/W2.11(ver 1)  
hit: 0.126185 test\_db1/Person/W2.12(ver 1)  
hit: 0.126185 test\_db1/Person/W2.13(ver 1)  
hit: 0.126185 test\_db1/Person/W2.14(ver 1)

{"title":"Person template","desc":"Person template","path":"/  
test\_db1/template/CrmPerson","version":1},{"title":"Person  
template","desc":"Person template","path":"/test\_db1/template/  
CrmCompany","version":1},{"title":"Steven Boutte","desc":"Contacts  
person document containing details of Steven Boutte","path":"/  
test\_db1/Person/W2.7","version":1},{"title":"Joe  
Hunter","desc":"Contacts person document containing details of Joe  
Hunter","path":"/test\_db1/Person/W2.8","version":1},  
{"title":"Joseph Wells","desc":"Contacts person document containing  
details of Joseph Wells","path":"/test\_db1/Person/W2.9","version":  
1},{"title":"Albert Brown","desc":"Contacts person document containing  
details of Albert Brown","path":"/test\_db1/Person/W2.10","version":  
1},{"title":"Mike Rivera","desc":"Contacts person document containing  
details of Mike Rivera","path":"/test\_db1/Person/W2.11","version":  
1},{"title":"Sandra Hohl","desc":"Contacts person document containing  
details of Sandra Hohl","path":"/test\_db1/Person/W2.12","version":  
1},{"title":"Curt Adamski","desc":"Contacts person document c  
ontaining details of Curt Adamski","path":"/test\_db1/Person/  
W2.13","version":1},{"title":"Darlene Quandt","desc":"Contacts person  
document containing details of Darlene Quandt","path":"/test\_db1/  
Person/W2.14","version":1}

From the results above, I would like to filter those with title =  
"Person template" or version = 1. But, I fail to do so provided the  
codes below:

```
                    QueryBuilder qb =

```

QueryBuilders.queryString("Person");

```
                    AndFilterBuilder myFilters =

```

FilterBuilders.andFilter();  
//  
myFilters.add(FilterBuilders.termFilter("version", "1"));

myFilters.add(FilterBuilders.termFilter("title", "Person template"));

// QueryBuilder qb =  
QueryBuilders.filteredQuery(QueryBuilders.queryString(query),  
myFilters);

// QueryBuilder qb =  
QueryBuilders.filteredQuery(QueryBuilders.queryString(query),  
// FilterBuilders.queryFilter( ... ));

```
                    searchResponse = client.prepareSearch(dbName)
                        .setSearchType(SearchType.QUERY_THEN_FETCH)
                        .setQuery(qb)
                        .setFilter(myFilters)
                        .setVersion(true)
                        .setFrom(start)
                        .setSize(size)
                        // .setExplain(true) // Explain hit score
                        // .setNoFields() // Do not return

```

stored fields  
.addField("document.title")  
.addField("document.desc")  
.execute()  
.actionGet();

Thanks,  
Ariel

On Feb 1, 1:42 am, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:

> Really hard to help without knowing what filter you use, the data you index, and how its mapped...
> 
> On Tuesday, January 31, 2012 at 11:22 AM, Ariel Mendoza wrote:
> 
> > I am using Java API for text search. Refer to the codes below, when I  
> > execute it, no record is retrieve though the Filter parameters of  
> > field and value pair I've set are correct, but when I comment-out or  
> > remove the .setFilter(fb), the search works fine. Please let me know  
> > if I'm doing this wrong or are there other approach to achieve my  
> > goal?
> 
> > searchResponse = client.prepareSearch(dbName)  
> > .setSearchType(SearchType.QUERY\_THEN\_FETCH)  
> > .setQuery(qb)  
> > .setFilter(fb)  
> > .setVersion(true)  
> > .setFrom(start)  
> > .setSize(size)  
> > // .setExplain(true) // Explain hit score  
> > // .setNoFields() // Do not return  
> > stored fields  
> > .addField("document.title")  
> > .addField("document.desc")  
> > .execute()  
> > .actionGet();

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [February 1, 2012, 9:40am UTC](https://discuss.elastic.co/t/java-api-search-with-querybuilder-and-filterbuilder/6552/4 "2012-02-01T09:40:11Z")

</div>

Its probably because the title is analyzed, so its broken down into (modified) terms, for example, "Person template" will be broken down into two tokens, "person" and "template". When you use term filter, it only works on actual tokens. You can have the title not analyzed in the mapping (or use a multi field mapping that has it both as analyzed and not\_analyzed) and then filter on the not analyzed version of it.

On Wednesday, February 1, 2012 at 2:35 AM, Ariel Mendoza wrote:

> Hi Shay,
> 
> I am using AndFilterBuilder. Here are the results when setFilter(fb)  
> is commented-out.
> 
> Search 'Person': took 68ms, shards 1:0  
> hit: 0.220823 test\_db1/template/CrmPerson(ver 1)  
> hit: 0.220823 test\_db1/template/CrmCompany(ver 1)  
> hit: 0.126185 test\_db1/Person/W2.7(ver 1)  
> hit: 0.126185 test\_db1/Person/W2.8(ver 1)  
> hit: 0.126185 test\_db1/Person/W2.9(ver 1)  
> hit: 0.126185 test\_db1/Person/W2.10(ver 1)  
> hit: 0.126185 test\_db1/Person/W2.11(ver 1)  
> hit: 0.126185 test\_db1/Person/W2.12(ver 1)  
> hit: 0.126185 test\_db1/Person/W2.13(ver 1)  
> hit: 0.126185 test\_db1/Person/W2.14(ver 1)
> 
> {"title":"Person template","desc":"Person template","path":"/  
> test\_db1/template/CrmPerson","version":1},{"title":"Person  
> template","desc":"Person template","path":"/test\_db1/template/  
> CrmCompany","version":1},{"title":"Steven Boutte","desc":"Contacts  
> person document containing details of Steven Boutte","path":"/  
> test\_db1/Person/W2.7","version":1},{"title":"Joe  
> Hunter","desc":"Contacts person document containing details of Joe  
> Hunter","path":"/test\_db1/Person/W2.8","version":1},  
> {"title":"Joseph Wells","desc":"Contacts person document containing  
> details of Joseph Wells","path":"/test\_db1/Person/W2.9","version":  
> 1},{"title":"Albert Brown","desc":"Contacts person document containing  
> details of Albert Brown","path":"/test\_db1/Person/W2.10","version":  
> 1},{"title":"Mike Rivera","desc":"Contacts person document containing  
> details of Mike Rivera","path":"/test\_db1/Person/W2.11","version":  
> 1},{"title":"Sandra Hohl","desc":"Contacts person document containing  
> details of Sandra Hohl","path":"/test\_db1/Person/W2.12","version":  
> 1},{"title":"Curt Adamski","desc":"Contacts person document c  
> ontaining details of Curt Adamski","path":"/test\_db1/Person/  
> W2.13","version":1},{"title":"Darlene Quandt","desc":"Contacts person  
> document containing details of Darlene Quandt","path":"/test\_db1/  
> Person/W2.14","version":1}
> 
> From the results above, I would like to filter those with title =  
> "Person template" or version = 1. But, I fail to do so provided the  
> codes below:
> 
> QueryBuilder qb =  
> QueryBuilders.queryString("Person");
> 
> AndFilterBuilder myFilters =  
> FilterBuilders.andFilter();  
> //  
> myFilters.add(FilterBuilders.termFilter("version", "1"));
> 
> myFilters.add(FilterBuilders.termFilter("title", "Person template"));
> 
> // QueryBuilder qb =  
> QueryBuilders.filteredQuery(QueryBuilders.queryString(query),  
> myFilters);
> 
> // QueryBuilder qb =  
> QueryBuilders.filteredQuery(QueryBuilders.queryString(query),  
> // FilterBuilders.queryFilter( ... ));
> 
> searchResponse = client.prepareSearch(dbName)  
> .setSearchType(SearchType.QUERY\_THEN\_FETCH)  
> .setQuery(qb)  
> .setFilter(myFilters)  
> .setVersion(true)  
> .setFrom(start)  
> .setSize(size)  
> // .setExplain(true) // Explain hit score  
> // .setNoFields() // Do not return  
> stored fields  
> .addField("document.title")  
> .addField("document.desc")  
> .execute()  
> .actionGet();
> 
> Thanks,  
> Ariel
> 
> On Feb 1, 1:42 am, Shay Banon \<[kim...@gmail.com](mailto:kim...@gmail.com) ([http://gmail.com](http://gmail.com))\> wrote:
> 
> > Really hard to help without knowing what filter you use, the data you index, and how its mapped...
> > 
> > On Tuesday, January 31, 2012 at 11:22 AM, Ariel Mendoza wrote:
> > 
> > > I am using Java API for text search. Refer to the codes below, when I  
> > > execute it, no record is retrieve though the Filter parameters of  
> > > field and value pair I've set are correct, but when I comment-out or  
> > > remove the .setFilter(fb), the search works fine. Please let me know  
> > > if I'm doing this wrong or are there other approach to achieve my  
> > > goal?
> > 
> > > searchResponse = client.prepareSearch(dbName)  
> > > .setSearchType(SearchType.QUERY\_THEN\_FETCH)  
> > > .setQuery(qb)  
> > > .setFilter(fb)  
> > > .setVersion(true)  
> > > .setFrom(start)  
> > > .setSize(size)  
> > > // .setExplain(true) // Explain hit score  
> > > // .setNoFields() // Do not return  
> > > stored fields  
> > > .addField("document.title")  
> > > .addField("document.desc")  
> > > .execute()  
> > > .actionGet();

---

<div class="post-metadata">

**Author:** ![mukesh](https://avatars.discourse-cdn.com/v4/letter/m/aeb1de/32.png) [@mukesh](https://discuss.elastic.co/u/mukesh)\
**Post date:** [February 18, 2013, 6:00am UTC](https://discuss.elastic.co/t/java-api-search-with-querybuilder-and-filterbuilder/6552/5 "2013-02-18T06:00:09Z")

</div>

I have already facing same problem

Settings settings = ImmutableSettings.settingsBuilder().put("cluster.name",  
"elasticsearch").build();  
Client client = new  
TransportClient(settings).addTransportAddress(new  
InetSocketTransportAddress("192.168.1.16", 9300));

client.admin().indices().prepareRefresh("resume\_index").execute().actionGet();  
FilterBuilders.andFilter(  
FilterBuilders.prefixFilter("keyskil", "asp"),  
FilterBuilders.prefixFilter("CurrentLocation", "delhi")  
);  
AndFilterBuilder queryFilters = FilterBuilders.andFilter();  
queryFilters.add(FilterBuilders.prefixFilter("keyskil", "asp"));  
queryFilters.add(FilterBuilders.prefixFilter("CurrentLocation",  
"n"));  
FilterBuilder aggFilter = FilterBuilders.andFilter(queryFilters);  
SearchResponse response = client.prepareSearch("resume\_index")

.setSearchType(SearchType.DFS\_QUERY\_THEN\_FETCH)  
//.setFilter(aggFilter)

//.setQuery(QueryBuilders.termQuery("KeySkills", "red"))

//.setQuery(QueryBuilders.prefixQuery("CurrentLocation","n"))  
.setFrom(0)  
.setSize(2)  
.setExplain(true)  
.execute()  
.actionGet();

```
        System.out.println(response.toString());
        String s=response.toString();

```

find result:

{  
"took" : 0,  
"timed\_out" : false,  
"\_shards" : {  
"total" : 5,  
"successful" : 5,  
"failed" : 0  
},  
"hits" : {  
"total" : 261,  
"max\_score" : 1.0,  
"hits" : [ {  
"\_shard" : 0,  
"\_node" : "Gik4Z040QSSzsNRlS9sVew",  
"\_index" : "resume\_index",  
"_type" : "emls_",  
"\_id" : "\<[CAFV6cM-pUaUTLFv-uDvTXHvYDHOV61vyQL5WdxAfiGLmBYkcLail.com](http://CAFV6cM-pUaUTLFv-uDvTXHvYDHOV61vyQL5WdxAfiGLmBYkcLail.com)\>",  
"\_score" : 1.0, "\_source" : {"From":"ajay.singh@com","Subject":"Fwd:  
check file  
parser","Path":"E:\emls\output\ajacom.lalituttam\_129.doc","ResumeHeadline":"[asp.net](http://asp.net)  
developerhaving 2 year and 5 months experience ","KeySkills":"[ASP.Net](http://ASP.Net) &  
C#.NetWith SQLServer 2005 ","Name":"saris kumar gupta  
","TotalExperience":"2 Years, 1 Months ","CTC":"Rs1.45 lacs  
","CurrentEmployer":"IAP Company Limited  
","CurrentDesignation":"SoftwareProgrammer  
","LastEmployer":null,"LastDesignation":null,"CurrentLocation":null,"PreferredLocation":null,"Education":"B.A,  
MCA ","Mobile":"7388852980 ","Landline":"91-- ","Recommendations":"Not  
Mentioned ","Lastmodifiedon":"14-Mar-2012 "},  
"\_explanation" : {  
"value" : 1.0,  
"description" : "ConstantScore(NotDeleted(_:_)), product of:",  
"details" : [ {  
"value" : 1.0,  
"description" : "boost"  
}, {  
"value" : 1.0,  
"description" : "queryNorm"  
} ]  
}  
}, {............................

but when //.setFilter(aggFilter) comments out then find result

# { "took" : 16, "timed\_out" : false, "\_shards" : { "total" : 5, "successful" : 5, "failed" : 0 }, "hits" : { "total" : 0, "max\_score" : null, "hits" : } } please let me know whats the error? I want search on basis of multiple filed..

On Wednesday, February 1, 2012 3:10:11 PM UTC+5:30, kimchy wrote:

> Its probably because the title is analyzed, so its broken down into  
> (modified) terms, for example, "Person template" will be broken down into  
> two tokens, "person" and "template". When you use term filter, it only  
> works on actual tokens. You can have the title not analyzed in the mapping  
> (or use a multi field mapping that has it both as analyzed and  
> not\_analyzed) and then filter on the not analyzed version of it.
> 
> On Wednesday, February 1, 2012 at 2:35 AM, Ariel Mendoza wrote:
> 
> Hi Shay,
> 
> I am using AndFilterBuilder. Here are the results when setFilter(fb)  
> is commented-out.
> 
> Search 'Person': took 68ms, shards 1:0  
> hit: 0.220823 test\_db1/template/CrmPerson(ver 1)  
> hit: 0.220823 test\_db1/template/CrmCompany(ver 1)  
> hit: 0.126185 test\_db1/Person/W2.7(ver 1)  
> hit: 0.126185 test\_db1/Person/W2.8(ver 1)  
> hit: 0.126185 test\_db1/Person/W2.9(ver 1)  
> hit: 0.126185 test\_db1/Person/W2.10(ver 1)  
> hit: 0.126185 test\_db1/Person/W2.11(ver 1)  
> hit: 0.126185 test\_db1/Person/W2.12(ver 1)  
> hit: 0.126185 test\_db1/Person/W2.13(ver 1)  
> hit: 0.126185 test\_db1/Person/W2.14(ver 1)
> 
> {"title":"Person template","desc":"Person template","path":"/  
> test\_db1/template/CrmPerson","version":1},{"title":"Person  
> template","desc":"Person template","path":"/test\_db1/template/  
> CrmCompany","version":1},{"title":"Steven Boutte","desc":"Contacts  
> person document containing details of Steven Boutte","path":"/  
> test\_db1/Person/W2.7","version":1},{"title":"Joe  
> Hunter","desc":"Contacts person document containing details of Joe  
> Hunter","path":"/test\_db1/Person/W2.8","version":1},  
> {"title":"Joseph Wells","desc":"Contacts person document containing  
> details of Joseph Wells","path":"/test\_db1/Person/W2.9","version":  
> 1},{"title":"Albert Brown","desc":"Contacts person document containing  
> details of Albert Brown","path":"/test\_db1/Person/W2.10","version":  
> 1},{"title":"Mike Rivera","desc":"Contacts person document containing  
> details of Mike Rivera","path":"/test\_db1/Person/W2.11","version":  
> 1},{"title":"Sandra Hohl","desc":"Contacts person document containing  
> details of Sandra Hohl","path":"/test\_db1/Person/W2.12","version":  
> 1},{"title":"Curt Adamski","desc":"Contacts person document c  
> ontaining details of Curt Adamski","path":"/test\_db1/Person/  
> W2.13","version":1},{"title":"Darlene Quandt","desc":"Contacts person  
> document containing details of Darlene Quandt","path":"/test\_db1/  
> Person/W2.14","version":1}
> 
> From the results above, I would like to filter those with title =  
> "Person template" or version = 1. But, I fail to do so provided the  
> codes below:
> 
> QueryBuilder qb =  
> QueryBuilders.queryString("Person");
> 
> AndFilterBuilder myFilters =  
> FilterBuilders.andFilter();  
> //  
> myFilters.add(FilterBuilders.termFilter("version", "1"));  
> myFilters.add(FilterBuilders.termFilter("title", "Person template"));
> 
> // QueryBuilder qb =  
> QueryBuilders.filteredQuery(QueryBuilders.queryString(query),  
> myFilters);
> 
> // QueryBuilder qb =  
> QueryBuilders.filteredQuery(QueryBuilders.queryString(query),  
> // FilterBuilders.queryFilter( ... ));
> 
> searchResponse = client.prepareSearch(dbName)  
> .setSearchType(SearchType.QUERY\_THEN\_FETCH)  
> .setQuery(qb)  
> .setFilter(myFilters)  
> .setVersion(true)  
> .setFrom(start)  
> .setSize(size)  
> // .setExplain(true) // Explain hit score  
> // .setNoFields() // Do not return  
> stored fields  
> .addField("document.title")  
> .addField("document.desc")  
> .execute()  
> .actionGet();
> 
> Thanks,  
> Ariel
> 
> On Feb 1, 1:42 am, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:
> 
> Really hard to help without knowing what filter you use, the data you  
> index, and how its mapped...
> 
> On Tuesday, January 31, 2012 at 11:22 AM, Ariel Mendoza wrote:
> 
> I am using Java API for text search. Refer to the codes below, when I  
> execute it, no record is retrieve though the Filter parameters of  
> field and value pair I've set are correct, but when I comment-out or  
> remove the .setFilter(fb), the search works fine. Please let me know  
> if I'm doing this wrong or are there other approach to achieve my  
> goal?
> 
> searchResponse = client.prepareSearch(dbName)  
> .setSearchType(SearchType.QUERY\_THEN\_FETCH)  
> .setQuery(qb)  
> .setFilter(fb)  
> .setVersion(true)  
> .setFrom(start)  
> .setSize(size)  
> // .setExplain(true) // Explain hit score  
> // .setNoFields() // Do not return  
> stored fields  
> .addField("document.title")  
> .addField("document.desc")  
> .execute()  
> .actionGet();

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [February 18, 2013, 6:54am UTC](https://discuss.elastic.co/t/java-api-search-with-querybuilder-and-filterbuilder/6552/6 "2013-02-18T06:54:10Z")

</div>

Do you have a document with CurrentLocation=n ?

Hard to say something else as we don't know your mapping either your docs.

--  
David 😉  
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 18 févr. 2013 à 07:00, MUKESH PANDEY [mukeshp073@gmail.com](mailto:mukeshp073@gmail.com) a écrit :

I have already facing same problem

Settings settings = ImmutableSettings.settingsBuilder().put("cluster.name", "elasticsearch").build();  
Client client = new TransportClient(settings).addTransportAddress(new InetSocketTransportAddress("192.168.1.16", 9300));  
client.admin().indices().prepareRefresh("resume\_index").execute().actionGet();  
FilterBuilders.andFilter(  
FilterBuilders.prefixFilter("keyskil", "asp"),  
FilterBuilders.prefixFilter("CurrentLocation", "delhi")  
);  
AndFilterBuilder queryFilters = FilterBuilders.andFilter();  
queryFilters.add(FilterBuilders.prefixFilter("keyskil", "asp"));  
queryFilters.add(FilterBuilders.prefixFilter("CurrentLocation", "n"));  
FilterBuilder aggFilter = FilterBuilders.andFilter(queryFilters);  
SearchResponse response = client.prepareSearch("resume\_index")  
.setSearchType(SearchType.DFS\_QUERY\_THEN\_FETCH)  
//.setFilter(aggFilter)  
//.setQuery(QueryBuilders.termQuery("KeySkills", "red"))  
//.setQuery(QueryBuilders.prefixQuery("CurrentLocation","n"))  
.setFrom(0)  
.setSize(2)  
.setExplain(true)  
.execute()  
.actionGet();

```
        System.out.println(response.toString());
        String s=response.toString();

```

find result:

{  
"took" : 0,  
"timed\_out" : false,  
"\_shards" : {  
"total" : 5,  
"successful" : 5,  
"failed" : 0  
},  
"hits" : {  
"total" : 261,  
"max\_score" : 1.0,  
"hits" : [ {  
"\_shard" : 0,  
"\_node" : "Gik4Z040QSSzsNRlS9sVew",  
"\_index" : "resume\_index",  
"_type" : "emls_",  
"\_id" : "\<[CAFV6cM-pUaUTLFv-uDvTXHvYDHOV61vyQL5WdxAfiGLmBYkcLail.com](http://CAFV6cM-pUaUTLFv-uDvTXHvYDHOV61vyQL5WdxAfiGLmBYkcLail.com)\>",  
"\_score" : 1.0, "\_source" : {"From":"ajay.singh@com","Subject":"Fwd: check file parser","Path":"E:\emls\output\ajacom.lalituttam\_129.doc","ResumeHeadline":"[asp.net](http://asp.net) developerhaving 2 year and 5 months experience ","KeySkills":"[ASP.Net](http://ASP.Net) & C#.NetWith SQLServer 2005 ","Name":"saris kumar gupta ","TotalExperience":"2 Years, 1 Months ","CTC":"Rs1.45 lacs ","CurrentEmployer":"IAP Company Limited ","CurrentDesignation":"SoftwareProgrammer ","LastEmployer":null,"LastDesignation":null,"CurrentLocation":null,"PreferredLocation":null,"Education":"B.A, MCA ","Mobile":"7388852980 ","Landline":"91-- ","Recommendations":"Not Mentioned ","Lastmodifiedon":"14-Mar-2012 "},  
"\_explanation" : {  
"value" : 1.0,  
"description" : "ConstantScore(NotDeleted(_:_)), product of:",  
"details" : [ {  
"value" : 1.0,  
"description" : "boost"  
}, {  
"value" : 1.0,  
"description" : "queryNorm"  
} ]  
}  
}, {............................

but when //.setFilter(aggFilter) comments out then find result

# { "took" : 16, "timed\_out" : false, "\_shards" : { "total" : 5, "successful" : 5, "failed" : 0 }, "hits" : { "total" : 0, "max\_score" : null, "hits" : } } please let me know whats the error? I want search on basis of multiple filed..

On Wednesday, February 1, 2012 3:10:11 PM UTC+5:30, kimchy wrote:

> Its probably because the title is analyzed, so its broken down into (modified) terms, for example, "Person template" will be broken down into two tokens, "person" and "template". When you use term filter, it only works on actual tokens. You can have the title not analyzed in the mapping (or use a multi field mapping that has it both as analyzed and not\_analyzed) and then filter on the not analyzed version of it.  
> On Wednesday, February 1, 2012 at 2:35 AM, Ariel Mendoza wrote:
> 
> > Hi Shay,
> > 
> > I am using AndFilterBuilder. Here are the results when setFilter(fb)  
> > is commented-out.
> > 
> > Search 'Person': took 68ms, shards 1:0  
> > hit: 0.220823 test\_db1/template/CrmPerson(ver 1)  
> > hit: 0.220823 test\_db1/template/CrmCompany(ver 1)  
> > hit: 0.126185 test\_db1/Person/W2.7(ver 1)  
> > hit: 0.126185 test\_db1/Person/W2.8(ver 1)  
> > hit: 0.126185 test\_db1/Person/W2.9(ver 1)  
> > hit: 0.126185 test\_db1/Person/W2.10(ver 1)  
> > hit: 0.126185 test\_db1/Person/W2.11(ver 1)  
> > hit: 0.126185 test\_db1/Person/W2.12(ver 1)  
> > hit: 0.126185 test\_db1/Person/W2.13(ver 1)  
> > hit: 0.126185 test\_db1/Person/W2.14(ver 1)
> > 
> > {"title":"Person template","desc":"Person template","path":"/  
> > test\_db1/template/CrmPerson","version":1},{"title":"Person  
> > template","desc":"Person template","path":"/test\_db1/template/  
> > CrmCompany","version":1},{"title":"Steven Boutte","desc":"Contacts  
> > person document containing details of Steven Boutte","path":"/  
> > test\_db1/Person/W2.7","version":1},{"title":"Joe  
> > Hunter","desc":"Contacts person document containing details of Joe  
> > Hunter","path":"/test\_db1/Person/W2.8","version":1},  
> > {"title":"Joseph Wells","desc":"Contacts person document containing  
> > details of Joseph Wells","path":"/test\_db1/Person/W2.9","version":  
> > 1},{"title":"Albert Brown","desc":"Contacts person document containing  
> > details of Albert Brown","path":"/test\_db1/Person/W2.10","version":  
> > 1},{"title":"Mike Rivera","desc":"Contacts person document containing  
> > details of Mike Rivera","path":"/test\_db1/Person/W2.11","version":  
> > 1},{"title":"Sandra Hohl","desc":"Contacts person document containing  
> > details of Sandra Hohl","path":"/test\_db1/Person/W2.12","version":  
> > 1},{"title":"Curt Adamski","desc":"Contacts person document c  
> > ontaining details of Curt Adamski","path":"/test\_db1/Person/  
> > W2.13","version":1},{"title":"Darlene Quandt","desc":"Contacts person  
> > document containing details of Darlene Quandt","path":"/test\_db1/  
> > Person/W2.14","version":1}
> > 
> > From the results above, I would like to filter those with title =  
> > "Person template" or version = 1. But, I fail to do so provided the  
> > codes below:
> > 
> > QueryBuilder qb =  
> > QueryBuilders.queryString("Person");
> > 
> > AndFilterBuilder myFilters =  
> > FilterBuilders.andFilter();  
> > //  
> > myFilters.add(FilterBuilders.termFilter("version", "1"));  
> > myFilters.add(FilterBuilders.termFilter("title", "Person template"));
> > 
> > // QueryBuilder qb =  
> > QueryBuilders.filteredQuery(QueryBuilders.queryString(query),  
> > myFilters);
> > 
> > // QueryBuilder qb =  
> > QueryBuilders.filteredQuery(QueryBuilders.queryString(query),  
> > // FilterBuilders.queryFilter( ... ));
> > 
> > searchResponse = client.prepareSearch(dbName)  
> > .setSearchType(SearchType.QUERY\_THEN\_FETCH)  
> > .setQuery(qb)  
> > .setFilter(myFilters)  
> > .setVersion(true)  
> > .setFrom(start)  
> > .setSize(size)  
> > // .setExplain(true) // Explain hit score  
> > // .setNoFields() // Do not return  
> > stored fields  
> > .addField("document.title")  
> > .addField("document.desc")  
> > .execute()  
> > .actionGet();
> > 
> > Thanks,  
> > Ariel
> > 
> > On Feb 1, 1:42 am, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:
> > 
> > > Really hard to help without knowing what filter you use, the data you index, and how its mapped...
> > > 
> > > On Tuesday, January 31, 2012 at 11:22 AM, Ariel Mendoza wrote:
> > > 
> > > > I am using Java API for text search. Refer to the codes below, when I  
> > > > execute it, no record is retrieve though the Filter parameters of  
> > > > field and value pair I've set are correct, but when I comment-out or  
> > > > remove the .setFilter(fb), the search works fine. Please let me know  
> > > > if I'm doing this wrong or are there other approach to achieve my  
> > > > goal?
> > > 
> > > > searchResponse = client.prepareSearch(dbName)  
> > > > .setSearchType(SearchType.QUERY\_THEN\_FETCH)  
> > > > .setQuery(qb)  
> > > > .setFilter(fb)  
> > > > .setVersion(true)  
> > > > .setFrom(start)  
> > > > .setSize(size)  
> > > > // .setExplain(true) // Explain hit score  
> > > > // .setNoFields() // Do not return  
> > > > stored fields  
> > > > .addField("document.title")  
> > > > .addField("document.desc")  
> > > > .execute()  
> > > > .actionGet();  
> > > > --  
> > > > 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).  
> > > > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![mukesh](https://avatars.discourse-cdn.com/v4/letter/m/aeb1de/32.png) [@mukesh](https://discuss.elastic.co/u/mukesh)\
**Post date:** [February 18, 2013, 8:20am UTC](https://discuss.elastic.co/t/java-api-search-with-querybuilder-and-filterbuilder/6552/7 "2013-02-18T08:20:00Z")

</div>

yes i have CurrentLocation:Navi Mumbai  
ok i have change CurrentLocation:delhi but  
i think when we using prefixFilter than match with "null" if no  
any match found and should return result so My question still same why  
Filter not working when comments out than find result

# { "took" : 31, "timed\_out" : false, "\_shards" : { "total" : 5, "successful" : 5, "failed" : 0 }, "hits" : { "total" : 0, "max\_score" : null, "hits" : } } so please suggest me how to search on the basis of skills and location with java api?

On Mon, Feb 18, 2013 at 12:24 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:

> Do you have a document with CurrentLocation=n ?
> 
> Hard to say something else as we don't know your mapping either your docs.
> 
> --  
> David 😉  
> Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
> 
> Le 18 févr. 2013 à 07:00, MUKESH PANDEY [mukeshp073@gmail.com](mailto:mukeshp073@gmail.com) a écrit :
> 
> I have already facing same problem
> 
> Settings settings = ImmutableSettings.settingsBuilder().put("cluster.name",  
> "elasticsearch").build();  
> Client client = new  
> TransportClient(settings).addTransportAddress(new  
> InetSocketTransportAddress("192.168.1.16", 9300));
> 
> client.admin().indices().prepareRefresh("resume\_index").execute().actionGet();  
> FilterBuilders.andFilter(  
> FilterBuilders.prefixFilter("keyskil", "asp"),  
> FilterBuilders.prefixFilter("CurrentLocation", "delhi")  
> );  
> AndFilterBuilder queryFilters = FilterBuilders.andFilter();  
> queryFilters.add(FilterBuilders.prefixFilter("keyskil", "asp"));  
> queryFilters.add(FilterBuilders.prefixFilter("CurrentLocation",  
> "n"));  
> FilterBuilder aggFilter =  
> FilterBuilders.andFilter(queryFilters);  
> SearchResponse response = client.prepareSearch("resume\_index")
> 
> .setSearchType(SearchType.DFS\_QUERY\_THEN\_FETCH)  
> //.setFilter(aggFilter)
> 
> //.setQuery(QueryBuilders.termQuery("KeySkills", "red"))
> 
> //.setQuery(QueryBuilders.prefixQuery("CurrentLocation","n"))  
> .setFrom(0)  
> .setSize(2)  
> .setExplain(true)  
> .execute()  
> .actionGet();
> 
> ```
> System.out.println(response.toString());
> String s=response.toString();
> 
> ```
> 
> find result:
> 
> {  
> "took" : 0,  
> "timed\_out" : false,  
> "\_shards" : {  
> "total" : 5,  
> "successful" : 5,  
> "failed" : 0  
> },  
> "hits" : {  
> "total" : 261,  
> "max\_score" : 1.0,  
> "hits" : [ {  
> "\_shard" : 0,  
> "\_node" : "Gik4Z040QSSzsNRlS9sVew",  
> "\_index" : "resume\_index",  
> "_type" : "emls_",  
> "\_id" : "\<[CAFV6cM-pUaUTLFv-uDvTXHvYDHOV61vyQL5WdxAfiGLmBYkcLail.com](http://CAFV6cM-pUaUTLFv-uDvTXHvYDHOV61vyQL5WdxAfiGLmBYkcLail.com)
> 
> > ",  
> > "\_score" : 1.0, "\_source" : {"From":"ajay.singh@com","Subject":"Fwd:  
> > check file  
> > parser","Path":"E:\emls\output\ajacom.lalituttam\_129.doc","ResumeHeadline":"  
> > [asp.net](http://asp.net) developerhaving 2 year and 5 months experience ","KeySkills":"  
> > [ASP.Net](http://ASP.Net) & C#.NetWith SQLServer 2005 ","Name":"saris kumar gupta  
> > ","TotalExperience":"2 Years, 1 Months ","CTC":"Rs1.45 lacs  
> > ","CurrentEmployer":"IAP Company Limited  
> > ","CurrentDesignation":"SoftwareProgrammer  
> > ","LastEmployer":null,"LastDesignation":null,"CurrentLocation":null,"PreferredLocation":null,"Education":"B.A,  
> > MCA ","Mobile":"7388852980 ","Landline":"91-- ","Recommendations":"Not  
> > Mentioned ","Lastmodifiedon":"14-Mar-2012 "},  
> > "\_explanation" : {  
> > "value" : 1.0,  
> > "description" : "ConstantScore(NotDeleted(_:_)), product of:",  
> > "details" : [ {  
> > "value" : 1.0,  
> > "description" : "boost"  
> > }, {  
> > "value" : 1.0,  
> > "description" : "queryNorm"  
> > } ]  
> > }  
> > }, {............................
> 
> but when //.setFilter(aggFilter) comments out then find result
> 
> {  
> "took" : 16,  
> "timed\_out" : false,  
> "\_shards" : {  
> "total" : 5,  
> "successful" : 5,  
> "failed" : 0  
> },  
> "hits" : {  
> "total" : 0,  
> "max\_score" : null,  
> "hits" :   
> }  
> } please let me know whats the error? I want search on basis of multiple  
> filed..
> 
> ============================================================================
> 
> On Wednesday, February 1, 2012 3:10:11 PM UTC+5:30, kimchy wrote:
> 
> > Its probably because the title is analyzed, so its broken down into  
> > (modified) terms, for example, "Person template" will be broken down into  
> > two tokens, "person" and "template". When you use term filter, it only  
> > works on actual tokens. You can have the title not analyzed in the mapping  
> > (or use a multi field mapping that has it both as analyzed and  
> > not\_analyzed) and then filter on the not analyzed version of it.
> > 
> > On Wednesday, February 1, 2012 at 2:35 AM, Ariel Mendoza wrote:
> > 
> > Hi Shay,
> > 
> > I am using AndFilterBuilder. Here are the results when setFilter(fb)  
> > is commented-out.
> > 
> > Search 'Person': took 68ms, shards 1:0  
> > hit: 0.220823 test\_db1/template/CrmPerson(\*\*ver 1)  
> > hit: 0.220823 test\_db1/template/CrmCompany(\*\*ver 1)  
> > hit: 0.126185 test\_db1/Person/W2.7(ver 1)  
> > hit: 0.126185 test\_db1/Person/W2.8(ver 1)  
> > hit: 0.126185 test\_db1/Person/W2.9(ver 1)  
> > hit: 0.126185 test\_db1/Person/W2.10(ver 1)  
> > hit: 0.126185 test\_db1/Person/W2.11(ver 1)  
> > hit: 0.126185 test\_db1/Person/W2.12(ver 1)  
> > hit: 0.126185 test\_db1/Person/W2.13(ver 1)  
> > hit: 0.126185 test\_db1/Person/W2.14(ver 1)
> > 
> > {"title":"Person template","desc":"Person template","path":"/  
> > test\_db1/template/CrmPerson"\*\*,"version":1},{"title":"Person  
> > template","desc":"Person template","path":"/test\_db1/\*\*template/  
> > CrmCompany","version":1},{"\*\*title":"Steven Boutte","desc":"Contacts  
> > person document containing details of Steven Boutte","path":"/  
> > test\_db1/Person/W2.7","\*\*version":1},{"title":"Joe  
> > Hunter","desc":"Contacts person document containing details of Joe  
> > Hunter","path":"/test\_db1/\*\*Person/W2.8","version":1},  
> > {"title":"Joseph Wells","desc":"Contacts person document containing  
> > details of Joseph Wells","path":"/test\_db1/\*\*Person/W2.9","version":  
> > 1},{"title":"Albert Brown","desc":"Contacts person document containing  
> > details of Albert Brown","path":"/test\_db1/\*\*Person/W2.10","version":  
> > 1},{"title":"Mike Rivera","desc":"Contacts person document containing  
> > details of Mike Rivera","path":"/test\_db1/\*\*Person/W2.11","version":  
> > 1},{"title":"Sandra Hohl","desc":"Contacts person document containing  
> > details of Sandra Hohl","path":"/test\_db1/\*\*Person/W2.12","version":  
> > 1},{"title":"Curt Adamski","desc":"Contacts person document c  
> > ontaining details of Curt Adamski","path":"/test\_db1/\*\*Person/  
> > W2.13","version":1},{"title":"\*\*Darlene Quandt","desc":"Contacts person  
> > document containing details of Darlene Quandt","path":"/test\_db1/  
> > Person/W2.14","version":1}
> > 
> > From the results above, I would like to filter those with title =  
> > "Person template" or version = 1. But, I fail to do so provided the  
> > codes below:
> > 
> > QueryBuilder qb =  
> > QueryBuilders.queryString("\*\*Person");
> > 
> > AndFilterBuilder myFilters =  
> > FilterBuilders.andFilter();  
> > //  
> > myFilters.add(FilterBuilders.\*\*termFilter("version", "1"));  
> > myFilters.add(FilterBuilders.\*\*termFilter("title", "Person template"));
> > 
> > // QueryBuilder qb =  
> > QueryBuilders.filteredQuery(\*\*QueryBuilders.queryString(\*\*query),  
> > myFilters);
> > 
> > // QueryBuilder qb =  
> > QueryBuilders.filteredQuery(\*\*QueryBuilders.queryString(\*\*query),  
> > // FilterBuilders.queryFilter( ... ));
> > 
> > searchResponse = client.prepareSearch(dbName)  
> > .setSearchType(SearchType.\*\*QUERY\_THEN\_FETCH)  
> > .setQuery(qb)  
> > .setFilter(myFilters)  
> > .setVersion(true)  
> > .setFrom(start)  
> > .setSize(size)  
> > // .setExplain(true) // Explain hit score  
> > // .setNoFields() // Do not return  
> > stored fields  
> > .addField("document.title")  
> > .addField("document.desc")  
> > .execute()  
> > .actionGet();
> > 
> > Thanks,  
> > Ariel
> > 
> > On Feb 1, 1:42 am, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:
> > 
> > Really hard to help without knowing what filter you use, the data you  
> > index, and how its mapped...
> > 
> > On Tuesday, January 31, 2012 at 11:22 AM, Ariel Mendoza wrote:
> > 
> > I am using Java API for text search. Refer to the codes below, when I  
> > execute it, no record is retrieve though the Filter parameters of  
> > field and value pair I've set are correct, but when I comment-out or  
> > remove the .setFilter(fb), the search works fine. Please let me know  
> > if I'm doing this wrong or are there other approach to achieve my  
> > goal?
> > 
> > searchResponse = client.prepareSearch(dbName)  
> > .setSearchType(SearchType.\*\*QUERY\_THEN\_FETCH)  
> > .setQuery(qb)  
> > .setFilter(fb)  
> > .setVersion(true)  
> > .setFrom(start)  
> > .setSize(size)  
> > // .setExplain(true) // Explain hit score  
> > // .setNoFields() // Do not return  
> > stored fields  
> > .addField("document.title")  
> > .addField("document.desc")  
> > .execute()  
> > .actionGet();
> > 
> > --  
> > 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).  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> 
> --  
> 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).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
[mukeshp073@gmail.com](mailto:mukeshp073@gmail.com)  
Laitkor.infosolution pvt ltd

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [February 18, 2013, 8:22am UTC](https://discuss.elastic.co/t/java-api-search-with-querybuilder-and-filterbuilder/6552/8 "2013-02-18T08:22:04Z")

</div>

Prefix filter is not analyzed. See [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/query-dsl/prefix-filter.html)

So, if you want to use it here, use it with a Capital N

--  
David Pilato | Technical Advocate | [Elasticsearch.com](http://Elasticsearch.com)  
@dadoonet | @elasticsearchfr | @scrutmydocs

Le 18 févr. 2013 à 09:20, MUKESH PANDEY [mukeshp073@gmail.com](mailto:mukeshp073@gmail.com) a écrit :

> yes i have CurrentLocation:Navi Mumbai  
> ok i have change CurrentLocation:delhi but  
> i think when we using prefixFilter than match with "null" if no any match found and should return result so My question still same why Filter not working when comments out than find result
> 
> # { "took" : 31, "timed\_out" : false, "\_shards" : { "total" : 5, "successful" : 5, "failed" : 0 }, "hits" : { "total" : 0, "max\_score" : null, "hits" : } } so please suggest me how to search on the basis of skills and location with java api?
> 
> On Mon, Feb 18, 2013 at 12:24 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:  
> Do you have a document with CurrentLocation=n ?
> 
> Hard to say something else as we don't know your mapping either your docs.
> 
> --  
> David 😉  
> Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
> 
> Le 18 févr. 2013 à 07:00, MUKESH PANDEY [mukeshp073@gmail.com](mailto:mukeshp073@gmail.com) a écrit :
> 
> I have already facing same problem
> 
> Settings settings = ImmutableSettings.settingsBuilder().put("cluster.name", "elasticsearch").build();  
> Client client = new TransportClient(settings).addTransportAddress(new InetSocketTransportAddress("192.168.1.16", 9300));  
> client.admin().indices().prepareRefresh("resume\_index").execute().actionGet();  
> FilterBuilders.andFilter(  
> FilterBuilders.prefixFilter("keyskil", "asp"),  
> FilterBuilders.prefixFilter("CurrentLocation", "delhi")  
> );  
> AndFilterBuilder queryFilters = FilterBuilders.andFilter();  
> queryFilters.add(FilterBuilders.prefixFilter("keyskil", "asp"));  
> queryFilters.add(FilterBuilders.prefixFilter("CurrentLocation", "n"));  
> FilterBuilder aggFilter = FilterBuilders.andFilter(queryFilters);  
> SearchResponse response = client.prepareSearch("resume\_index")  
> .setSearchType(SearchType.DFS\_QUERY\_THEN\_FETCH)  
> //.setFilter(aggFilter)  
> //.setQuery(QueryBuilders.termQuery("KeySkills", "red"))  
> //.setQuery(QueryBuilders.prefixQuery("CurrentLocation","n"))  
> .setFrom(0)  
> .setSize(2)  
> .setExplain(true)  
> .execute()  
> .actionGet();
> 
> ```
> System.out.println(response.toString());
> String s=response.toString();
> 
> ```
> 
> find result:
> 
> {  
> "took" : 0,  
> "timed\_out" : false,  
> "\_shards" : {  
> "total" : 5,  
> "successful" : 5,  
> "failed" : 0  
> },  
> "hits" : {  
> "total" : 261,  
> "max\_score" : 1.0,  
> "hits" : [ {  
> "\_shard" : 0,  
> "\_node" : "Gik4Z040QSSzsNRlS9sVew",  
> "\_index" : "resume\_index",  
> "_type" : "emls_",  
> "\_id" : "\<[CAFV6cM-pUaUTLFv-uDvTXHvYDHOV61vyQL5WdxAfiGLmBYkcLail.com](http://CAFV6cM-pUaUTLFv-uDvTXHvYDHOV61vyQL5WdxAfiGLmBYkcLail.com)\>",  
> "\_score" : 1.0, "\_source" : {"From":"ajay.singh@com","Subject":"Fwd: check file parser","Path":"E:\emls\output\ajacom.lalituttam\_129.doc","ResumeHeadline":"[asp.net](http://asp.net) developerhaving 2 year and 5 months experience ","KeySkills":"[ASP.Net](http://ASP.Net) & C#.NetWith SQLServer 2005 ","Name":"saris kumar gupta ","TotalExperience":"2 Years, 1 Months ","CTC":"Rs1.45 lacs ","CurrentEmployer":"IAP Company Limited ","CurrentDesignation":"SoftwareProgrammer ","LastEmployer":null,"LastDesignation":null,"CurrentLocation":null,"PreferredLocation":null,"Education":"B.A, MCA ","Mobile":"7388852980 ","Landline":"91-- ","Recommendations":"Not Mentioned ","Lastmodifiedon":"14-Mar-2012 "},  
> "\_explanation" : {  
> "value" : 1.0,  
> "description" : "ConstantScore(NotDeleted(_:_)), product of:",  
> "details" : [ {  
> "value" : 1.0,  
> "description" : "boost"  
> }, {  
> "value" : 1.0,  
> "description" : "queryNorm"  
> } ]  
> }  
> }, {............................
> 
> but when //.setFilter(aggFilter) comments out then find result
> 
> # { "took" : 16, "timed\_out" : false, "\_shards" : { "total" : 5, "successful" : 5, "failed" : 0 }, "hits" : { "total" : 0, "max\_score" : null, "hits" : } } please let me know whats the error? I want search on basis of multiple filed..
> 
> On Wednesday, February 1, 2012 3:10:11 PM UTC+5:30, kimchy wrote:  
> Its probably because the title is analyzed, so its broken down into (modified) terms, for example, "Person template" will be broken down into two tokens, "person" and "template". When you use term filter, it only works on actual tokens. You can have the title not analyzed in the mapping (or use a multi field mapping that has it both as analyzed and not\_analyzed) and then filter on the not analyzed version of it.  
> On Wednesday, February 1, 2012 at 2:35 AM, Ariel Mendoza wrote:
> 
> > Hi Shay,
> > 
> > I am using AndFilterBuilder. Here are the results when setFilter(fb)  
> > is commented-out.
> > 
> > Search 'Person': took 68ms, shards 1:0  
> > hit: 0.220823 test\_db1/template/CrmPerson(ver 1)  
> > hit: 0.220823 test\_db1/template/CrmCompany(ver 1)  
> > hit: 0.126185 test\_db1/Person/W2.7(ver 1)  
> > hit: 0.126185 test\_db1/Person/W2.8(ver 1)  
> > hit: 0.126185 test\_db1/Person/W2.9(ver 1)  
> > hit: 0.126185 test\_db1/Person/W2.10(ver 1)  
> > hit: 0.126185 test\_db1/Person/W2.11(ver 1)  
> > hit: 0.126185 test\_db1/Person/W2.12(ver 1)  
> > hit: 0.126185 test\_db1/Person/W2.13(ver 1)  
> > hit: 0.126185 test\_db1/Person/W2.14(ver 1)
> > 
> > {"title":"Person template","desc":"Person template","path":"/  
> > test\_db1/template/CrmPerson","version":1},{"title":"Person  
> > template","desc":"Person template","path":"/test\_db1/template/  
> > CrmCompany","version":1},{"title":"Steven Boutte","desc":"Contacts  
> > person document containing details of Steven Boutte","path":"/  
> > test\_db1/Person/W2.7","version":1},{"title":"Joe  
> > Hunter","desc":"Contacts person document containing details of Joe  
> > Hunter","path":"/test\_db1/Person/W2.8","version":1},  
> > {"title":"Joseph Wells","desc":"Contacts person document containing  
> > details of Joseph Wells","path":"/test\_db1/Person/W2.9","version":  
> > 1},{"title":"Albert Brown","desc":"Contacts person document containing  
> > details of Albert Brown","path":"/test\_db1/Person/W2.10","version":  
> > 1},{"title":"Mike Rivera","desc":"Contacts person document containing  
> > details of Mike Rivera","path":"/test\_db1/Person/W2.11","version":  
> > 1},{"title":"Sandra Hohl","desc":"Contacts person document containing  
> > details of Sandra Hohl","path":"/test\_db1/Person/W2.12","version":  
> > 1},{"title":"Curt Adamski","desc":"Contacts person document c  
> > ontaining details of Curt Adamski","path":"/test\_db1/Person/  
> > W2.13","version":1},{"title":"Darlene Quandt","desc":"Contacts person  
> > document containing details of Darlene Quandt","path":"/test\_db1/  
> > Person/W2.14","version":1}
> > 
> > From the results above, I would like to filter those with title =  
> > "Person template" or version = 1. But, I fail to do so provided the  
> > codes below:
> > 
> > QueryBuilder qb =  
> > QueryBuilders.queryString("Person");
> > 
> > AndFilterBuilder myFilters =  
> > FilterBuilders.andFilter();  
> > //  
> > myFilters.add(FilterBuilders.termFilter("version", "1"));  
> > myFilters.add(FilterBuilders.termFilter("title", "Person template"));
> > 
> > // QueryBuilder qb =  
> > QueryBuilders.filteredQuery(QueryBuilders.queryString(query),  
> > myFilters);
> > 
> > // QueryBuilder qb =  
> > QueryBuilders.filteredQuery(QueryBuilders.queryString(query),  
> > // FilterBuilders.queryFilter( ... ));
> > 
> > searchResponse = client.prepareSearch(dbName)  
> > .setSearchType(SearchType.QUERY\_THEN\_FETCH)  
> > .setQuery(qb)  
> > .setFilter(myFilters)  
> > .setVersion(true)  
> > .setFrom(start)  
> > .setSize(size)  
> > // .setExplain(true) // Explain hit score  
> > // .setNoFields() // Do not return  
> > stored fields  
> > .addField("document.title")  
> > .addField("document.desc")  
> > .execute()  
> > .actionGet();
> > 
> > Thanks,  
> > Ariel
> > 
> > On Feb 1, 1:42 am, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:
> > 
> > > Really hard to help without knowing what filter you use, the data you index, and how its mapped...
> > > 
> > > On Tuesday, January 31, 2012 at 11:22 AM, Ariel Mendoza wrote:
> > > 
> > > > I am using Java API for text search. Refer to the codes below, when I  
> > > > execute it, no record is retrieve though the Filter parameters of  
> > > > field and value pair I've set are correct, but when I comment-out or  
> > > > remove the .setFilter(fb), the search works fine. Please let me know  
> > > > if I'm doing this wrong or are there other approach to achieve my  
> > > > goal?
> > > 
> > > > searchResponse = client.prepareSearch(dbName)  
> > > > .setSearchType(SearchType.QUERY\_THEN\_FETCH)  
> > > > .setQuery(qb)  
> > > > .setFilter(fb)  
> > > > .setVersion(true)  
> > > > .setFrom(start)  
> > > > .setSize(size)  
> > > > // .setExplain(true) // Explain hit score  
> > > > // .setNoFields() // Do not return  
> > > > stored fields  
> > > > .addField("document.title")  
> > > > .addField("document.desc")  
> > > > .execute()  
> > > > .actionGet();
> 
> --  
> 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).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> 
> --  
> 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).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> 
> --  
> [mukeshp073@gmail.com](mailto:mukeshp073@gmail.com)  
> Laitkor.infosolution pvt ltd
> 
> --  
> 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).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![mukesh](https://avatars.discourse-cdn.com/v4/letter/m/aeb1de/32.png) [@mukesh](https://discuss.elastic.co/u/mukesh)\
**Post date:** [February 18, 2013, 11:06am UTC](https://discuss.elastic.co/t/java-api-search-with-querybuilder-and-filterbuilder/6552/9 "2013-02-18T11:06:26Z")

</div>

Thanks sir for support

====================================================================

On Mon, Feb 18, 2013 at 1:52 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:

> Prefix filter is not analyzed. See  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/query-dsl/prefix-filter.html)
> 
> So, if you want to use it here, use it with a Capital N
> 
> --  
> _David Pilato_ | _Technical Advocate_ | _[Elasticsearch.com](http://Elasticsearch.com)_  
> @dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr[https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr)  
> | @scrutmydocs [https://twitter.com/scrutmydocs](https://twitter.com/scrutmydocs)
> 
> Le 18 févr. 2013 à 09:20, MUKESH PANDEY [mukeshp073@gmail.com](mailto:mukeshp073@gmail.com) a écrit :
> 
> yes i have CurrentLocation:Navi Mumbai  
> ok i have change CurrentLocation:delhi but  
> i think when we using prefixFilter than match with "null" if  
> no any match found and should return result so My question still same why  
> Filter not working when comments out than find result
> 
> # { "took" : 31, "timed\_out" : false, "\_shards" : { "total" : 5, "successful" : 5, "failed" : 0 }, "hits" : { "total" : 0, "max\_score" : null, "hits" : } } so please suggest me how to search on the basis of skills and location with java api?
> 
> On Mon, Feb 18, 2013 at 12:24 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:
> 
> > Do you have a document with CurrentLocation=n ?
> > 
> > Hard to say something else as we don't know your mapping either your docs.
> > 
> > --  
> > David 😉  
> > Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
> > 
> > Le 18 févr. 2013 à 07:00, MUKESH PANDEY [mukeshp073@gmail.com](mailto:mukeshp073@gmail.com) a écrit :
> > 
> > I have already facing same problem
> > 
> > Settings settings = ImmutableSettings.settingsBuilder().put("cluster.name",  
> > "elasticsearch").build();  
> > Client client = new  
> > TransportClient(settings).addTransportAddress(new  
> > InetSocketTransportAddress("192.168.1.16", 9300));
> > 
> > client.admin().indices().prepareRefresh("resume\_index").execute().actionGet();  
> > FilterBuilders.andFilter(  
> > FilterBuilders.prefixFilter("keyskil", "asp"),  
> > FilterBuilders.prefixFilter("CurrentLocation", "delhi")  
> > );  
> > AndFilterBuilder queryFilters = FilterBuilders.andFilter();  
> > queryFilters.add(FilterBuilders.prefixFilter("keyskil",  
> > "asp"));  
> > queryFilters.add(FilterBuilders.prefixFilter("CurrentLocation",  
> > "n"));  
> > FilterBuilder aggFilter =  
> > FilterBuilders.andFilter(queryFilters);  
> > SearchResponse response = client.prepareSearch("resume\_index")
> > 
> > .setSearchType(SearchType.DFS\_QUERY\_THEN\_FETCH)  
> > //.setFilter(aggFilter)
> > 
> > //.setQuery(QueryBuilders.termQuery("KeySkills", "red"))
> > 
> > //.setQuery(QueryBuilders.prefixQuery("CurrentLocation","n"))  
> > .setFrom(0)  
> > .setSize(2)  
> > .setExplain(true)  
> > .execute()  
> > .actionGet();
> > 
> > ```
> > System.out.println(response.toString());
> > String s=response.toString();
> > 
> > ```
> > 
> > find result:
> > 
> > {  
> > "took" : 0,  
> > "timed\_out" : false,  
> > "\_shards" : {  
> > "total" : 5,  
> > "successful" : 5,  
> > "failed" : 0  
> > },  
> > "hits" : {  
> > "total" : 261,  
> > "max\_score" : 1.0,  
> > "hits" : [ {  
> > "\_shard" : 0,  
> > "\_node" : "Gik4Z040QSSzsNRlS9sVew",  
> > "\_index" : "resume\_index",  
> > "_type" : "emls_",  
> > "\_id" : "\<[CAFV6cM-pUaUTLFv-uDvTXHvYDHOV61vyQL5WdxAfiGLmBYkcLail.com](http://CAFV6cM-pUaUTLFv-uDvTXHvYDHOV61vyQL5WdxAfiGLmBYkcLail.com)[http://cafv6cm-puautlfv-udvtxhvydhov61vyql5wdxafiglmbykclail.com/](http://cafv6cm-puautlfv-udvtxhvydhov61vyql5wdxafiglmbykclail.com/)
> > 
> > > ",  
> > > "\_score" : 1.0, "\_source" : {"From":"ajay.singh@com","Subject":"Fwd:  
> > > check file parser","Path":"E:\emls\output\ajacom.lalituttam\_129.doc  
> > > ","ResumeHeadline":"[asp.net](http://asp.net) developerhaving 2 year and 5 months  
> > > experience ","KeySkills":"[ASP.Net](http://ASP.Net) [http://asp.net/](http://asp.net/) & C#.NetWith  
> > > SQLServer 2005 ","Name":"saris kumar gupta ","TotalExperience":"2 Years, 1  
> > > Months ","CTC":"Rs1.45 lacs ","CurrentEmployer":"IAP Company Limited  
> > > ","CurrentDesignation":"SoftwareProgrammer  
> > > ","LastEmployer":null,"LastDesignation":null,"CurrentLocation":null,"PreferredLocation":null,"Education":"B.A,  
> > > MCA ","Mobile":"7388852980 ","Landline":"91-- ","Recommendations":"Not  
> > > Mentioned ","Lastmodifiedon":"14-Mar-2012 "},  
> > > "\_explanation" : {  
> > > "value" : 1.0,  
> > > "description" : "ConstantScore(NotDeleted(_:_)), product of:",  
> > > "details" : [ {  
> > > "value" : 1.0,  
> > > "description" : "boost"  
> > > }, {  
> > > "value" : 1.0,  
> > > "description" : "queryNorm"  
> > > } ]  
> > > }  
> > > }, {............................
> > 
> > but when //.setFilter(aggFilter) comments out then find result
> > 
> > {  
> > "took" : 16,  
> > "timed\_out" : false,  
> > "\_shards" : {  
> > "total" : 5,  
> > "successful" : 5,  
> > "failed" : 0  
> > },  
> > "hits" : {  
> > "total" : 0,  
> > "max\_score" : null,  
> > "hits" :   
> > }  
> > } please let me know whats the error? I want search on basis of multiple  
> > filed..
> > 
> > ============================================================================
> > 
> > On Wednesday, February 1, 2012 3:10:11 PM UTC+5:30, kimchy wrote:
> > 
> > > Its probably because the title is analyzed, so its broken down into  
> > > (modified) terms, for example, "Person template" will be broken down into  
> > > two tokens, "person" and "template". When you use term filter, it only  
> > > works on actual tokens. You can have the title not analyzed in the mapping  
> > > (or use a multi field mapping that has it both as analyzed and  
> > > not\_analyzed) and then filter on the not analyzed version of it.
> > > 
> > > On Wednesday, February 1, 2012 at 2:35 AM, Ariel Mendoza wrote:
> > > 
> > > Hi Shay,
> > > 
> > > I am using AndFilterBuilder. Here are the results when setFilter(fb)  
> > > is commented-out.
> > > 
> > > Search 'Person': took 68ms, shards 1:0  
> > > hit: 0.220823 test\_db1/template/CrmPerson(\*\*ver 1)  
> > > hit: 0.220823 test\_db1/template/CrmCompany(\*\*ver 1)  
> > > hit: 0.126185 test\_db1/Person/W2.7(ver 1)  
> > > hit: 0.126185 test\_db1/Person/W2.8(ver 1)  
> > > hit: 0.126185 test\_db1/Person/W2.9(ver 1)  
> > > hit: 0.126185 test\_db1/Person/W2.10(ver 1)  
> > > hit: 0.126185 test\_db1/Person/W2.11(ver 1)  
> > > hit: 0.126185 test\_db1/Person/W2.12(ver 1)  
> > > hit: 0.126185 test\_db1/Person/W2.13(ver 1)  
> > > hit: 0.126185 test\_db1/Person/W2.14(ver 1)
> > > 
> > > {"title":"Person template","desc":"Person template","path":"/  
> > > test\_db1/template/CrmPerson"\*\*,"version":1},{"title":"Person  
> > > template","desc":"Person template","path":"/test\_db1/\*\*template/  
> > > CrmCompany","version":1},{"\*\*title":"Steven Boutte","desc":"Contacts  
> > > person document containing details of Steven Boutte","path":"/  
> > > test\_db1/Person/W2.7","\*\*version":1},{"title":"Joe  
> > > Hunter","desc":"Contacts person document containing details of Joe  
> > > Hunter","path":"/test\_db1/\*\*Person/W2.8","version":1},  
> > > {"title":"Joseph Wells","desc":"Contacts person document containing  
> > > details of Joseph Wells","path":"/test\_db1/\*\*Person/W2.9","version":  
> > > 1},{"title":"Albert Brown","desc":"Contacts person document containing  
> > > details of Albert Brown","path":"/test\_db1/\*\*Person/W2.10","version":  
> > > 1},{"title":"Mike Rivera","desc":"Contacts person document containing  
> > > details of Mike Rivera","path":"/test\_db1/\*\*Person/W2.11","version":  
> > > 1},{"title":"Sandra Hohl","desc":"Contacts person document containing  
> > > details of Sandra Hohl","path":"/test\_db1/\*\*Person/W2.12","version":  
> > > 1},{"title":"Curt Adamski","desc":"Contacts person document c  
> > > ontaining details of Curt Adamski","path":"/test\_db1/\*\*Person/  
> > > W2.13","version":1},{"title":"\*\*Darlene Quandt","desc":"Contacts person  
> > > document containing details of Darlene Quandt","path":"/test\_db1/  
> > > Person/W2.14","version":1}
> > > 
> > > From the results above, I would like to filter those with title =  
> > > "Person template" or version = 1. But, I fail to do so provided the  
> > > codes below:
> > > 
> > > QueryBuilder qb =  
> > > QueryBuilders.queryString("\*\*Person");
> > > 
> > > AndFilterBuilder myFilters =  
> > > FilterBuilders.andFilter();  
> > > //  
> > > myFilters.add(FilterBuilders.\*\*termFilter("version", "1"));  
> > > myFilters.add(FilterBuilders.\*\*termFilter("title", "Person template"));
> > > 
> > > // QueryBuilder qb =  
> > > QueryBuilders.filteredQuery(\*\*QueryBuilders.queryString(\*\*query),  
> > > myFilters);
> > > 
> > > // QueryBuilder qb =  
> > > QueryBuilders.filteredQuery(\*\*QueryBuilders.queryString(\*\*query),  
> > > // FilterBuilders.queryFilter( ... ));
> > > 
> > > searchResponse = client.prepareSearch(dbName)  
> > > .setSearchType(SearchType.\*\*QUERY\_THEN\_FETCH)  
> > > .setQuery(qb)  
> > > .setFilter(myFilters)  
> > > .setVersion(true)  
> > > .setFrom(start)  
> > > .setSize(size)  
> > > // .setExplain(true) // Explain hit score  
> > > // .setNoFields() // Do not return  
> > > stored fields  
> > > .addField("document.title")  
> > > .addField("document.desc")  
> > > .execute()  
> > > .actionGet();
> > > 
> > > Thanks,  
> > > Ariel
> > > 
> > > On Feb 1, 1:42 am, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:
> > > 
> > > Really hard to help without knowing what filter you use, the data you  
> > > index, and how its mapped...
> > > 
> > > On Tuesday, January 31, 2012 at 11:22 AM, Ariel Mendoza wrote:
> > > 
> > > I am using Java API for text search. Refer to the codes below, when I  
> > > execute it, no record is retrieve though the Filter parameters of  
> > > field and value pair I've set are correct, but when I comment-out or  
> > > remove the .setFilter(fb), the search works fine. Please let me know  
> > > if I'm doing this wrong or are there other approach to achieve my  
> > > goal?
> > > 
> > > searchResponse = client.prepareSearch(dbName)  
> > > .setSearchType(SearchType.\*\*QUERY\_THEN\_FETCH)  
> > > .setQuery(qb)  
> > > .setFilter(fb)  
> > > .setVersion(true)  
> > > .setFrom(start)  
> > > .setSize(size)  
> > > // .setExplain(true) // Explain hit score  
> > > // .setNoFields() // Do not return  
> > > stored fields  
> > > .addField("document.title")  
> > > .addField("document.desc")  
> > > .execute()  
> > > .actionGet();
> > 
> > --  
> > 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).  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> > 
> > --  
> > 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).  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> 
> --  
> [mukeshp073@gmail.com](mailto:mukeshp073@gmail.com)  
> Laitkor.infosolution pvt ltd
> 
> --  
> 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).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> 
> --  
> 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).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
[mukeshp073@gmail.com](mailto:mukeshp073@gmail.com)  
Laitkor.infosolution pvt ltd

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:51am UTC](https://discuss.elastic.co/t/java-api-search-with-querybuilder-and-filterbuilder/6552/10 "2017-07-06T02:51:00Z")

</div>


