this is my Json:
"_type":"emls","_source":
{"ResumeHeadline":"System/Networkadmin with 3 yrs of Experience ",
"LastEmployer":" 3i Infotech consultancyservices ",
"Subject":"Fwd: Naukri.com - SA:- September 2012, Linux System Administrator - Salary Best in Industry - Project Assistant, Homi Bhabha Centre for Science & Education, TIFR Mankhurd, Mumbai., 3.0 yrs, Navi Mumbai",
"CurrentDesignation":null,
"Recommendations":" Not Mentioned ",
"LastDesignation":" Assistant Engineer ",
"CurrentLocation":" NaviMumbai, Maharashtra, INDIA ",
"Path":"E:\emls\output\laitkor@gmail.com.tarubairam_21.doc","TotalExperience":null,
"Name":null,"Lastmodifiedon":" 07-Feb-2013",
"Landline":"91-- ",
Now using this code for filter search is any thing wrong ?
XContentBuilder indexSettings = null;
Settings settings = ImmutableSettings.settingsBuilder().put("cluster.name", "elasticsearch").build();
Client client = new TransportClient(settings).addTransportAddress(new InetSocketTransportAddress("192.168.X.XX", 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);
QueryBuilder queryBuilder = QueryBuilders.filteredQuery(QueryBuilders.prefixQuery("CurrentLocation", "d"),aggFilter);
SearchResponse response = client.prepareSearch("resume_index")
.setSearchType(SearchType.QUERY_AND_FETCH)
.setQuery(queryBuilder)
.setFilter(aggFilter)
//.setQuery(QueryBuilders.termQuery("Name", "Mahi Singh"))
//.setQuery(QueryBuilders.prefixQuery("CurrentLocation","d"))
// .setQuery(QueryBuilders.boolQuery().must(termQuery("CurrentLocation", "delhi")))
// .setQuery(QueryBuilders.prefixQuery("Name", "Mahi Singh"))
// .setQuery(QueryBuilders.prefixQuery("CurrentLocation","d"))
// .setQuery(QueryBuilders.boolQuery().must(termQuery("CurrentLocation","delhi")).must(termQuery("From","laitkor@gmail.com")))
.setFrom(66)
.setSize(100)
.setExplain(true)
.execute()
.actionGet();
System.out.println(response.toString());
find result:
{
"took" : 16,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" : [ ]
}
}