Hi All,
We have index mapping as mentioned below.
{
"test" : {
"tweet" : {
"properties" : {
"content1" : {
"type" : "string"
},
"message" : {
"type" : "string",
"store" : true
}
}
}
}
}
The value of field message is "won match test" and have inserted 10
records of similar type. On term facet over value, we are getting facet
count 30 for value "won match test" while we are expecting total count 10.
TermsFacetBuilder termsFacetBuilder = FacetBuilders.termsFacet(
"combine").fields("message").scriptField("_fields.message.value
").size(100);
SearchRequestBuilder searchRequestBuilder = client
.prepareSearch("test")
.setSearchType(SearchType.QUERY_THEN_FETCH)
.addFacet(termsFacetBuilder).setSize(10000);
SearchResponse searchResponse = searchRequestBuilder.execute()
.actionGet();
TermsFacet f = (TermsFacet) searchResponse.getFacets().facetsAsMap()
.get("combine");
System.out.println(f.getTotalCount()); // Total terms doc count
System.out.println(f.getOtherCount()); // Not shown terms doc count
System.out.println(f.getMissingCount()); // Without term doc count
// For each entry
for (TermsFacet.Entry entry : f) {
System.out.println(entry.getTerm());
System.out.println(entry.getCount());
}
Please help.
Regards,
Ankit Jain
--
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.
For more options, visit https://groups.google.com/groups/opt_out.