Re: Search response hits vs Facet count


(phill) #1

On 9/6/2012 7:35 AM, Dirk wrote:

Hi,

Regarding facet usage, is there any reason for doing the below:

{"query": {
"filtered" : {
"filter" : {
"term" : { "myField" : "myValue" }
},
"query" : { "match_all" : {} }
}
},
"facets" : {
"my_facet" : {
"filter" : {
"term" : { "myField" : "myValue" }
}
}
},
"from":0,
"size":20
}'

Can I not simply use the SearchResponse.hits.totalHits() count as this
would be same as the facet count in this case?

Kind Regards,

Dirk

totalHits is the number of documents, but I think if "myField" is
tokenized/analyzed won't the facet total include the total number of
occurrences of the field?
I'd try a simple example to test the idea.

-Paul

--


(system) #2