Hi David,
No, unfortunately, I'm after something slightly different. My terminology
hasn't been so good, so let me try to state it again.
For a given term facet request, you limit the number of results with
"size". (default 10 terms)
Returned is
{
"terms" <- up to "size" number of "name":"count" pairs
"total": <- the number of documents matched by the facet
"missing": <- the number of documents not having the property the facet
wants
"other": <- "total" minus the number of documents listed in "terms".
}
I'm interested in terms, not documents for my particular problem. In
particular, you can get the number of terms matched: terms.length, but you
can't get the number of terms not returned. That is the value I'm
interested in.
"The number of other terms not returned". The only way currently is to set
size = HUGENUMBER and request them all, then count them. I'm not interested
in their names and/or counts, or sending them all over the network, simply
how many more of them there are during the initial query.
Does that make sense?
I'm looking through the code trying to figure out where to add that
feature. I'm most of the way there I think but haven't found quite the
right place where all the terms are assembled yet.
Thanks,
Kevin
On Thursday, January 17, 2013 1:06:13 AM UTC-8, David Pilato wrote:
Hey Kevin,
I probably did not understand your use case. Why the standard Term Facet
did not answer to your need?
There is an "other" field which is part of the answer:
"facets" : {
"f1" : {
"_type" : "terms",
"missing" : 0,
"total" : 3,
"other" : 0,
"terms" : [ {
"term" : "b",
"count" : 2
}, {
"term" : "c",
"count" : 1
} ]
}
}
This field means that there are other terms than the TOP 10 (
https://github.com/elasticsearch/elasticsearch/issues/1029)
Isn't it what you are after?
David.
Le 17 janvier 2013 à 00:25, Ivan Brusic <iv...@brusic.com <javascript:>>
a écrit :
The terms facets works off the termlist found in the Lucene index. There
can never be a terms facet with a zero count. Facets never return the
elements, just the term and the count.
If you just want a list of terms, take a long at Jorg's plugin:
https://github.com/jprante/elasticsearch-index-termlist
The Lucene code is found here:
https://github.com/jprante/elasticsearch-index-termlist/blob/master/src/main/java/org/elasticsearch/action/termlist/TransportTermlistAction.java#L126
The plugin aggregates the termlists from each shard.
--
Ivan
On Wed, Jan 16, 2013 at 2:46 PM, Kevin Fox <kfox...@gmail.com<javascript:>
wrote:
So, the all_terms field says it returns all of the facets with counts = 0
even if there is nothing that matches that facet. That means, if there are
a lot of them, it sends them all across the wire. What I'm trying to do is
get the count of all facets minus the elements returned, so I can determine
if I want to requery with something like all_terms set to true or if it
would be too expensive to do so. Any idea where in the code I could add
that?
Thanks,
Kevin
--
--
David Pilato
http://www.scrutmydocs.org/
http://dev.david.pilato.fr/
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
--