I got termsstats facet code working in Java for a single non-numeric
key field. The way I did this is I introduced a new numeric field
called "counter" that always has a value 1. Here is an example of curl
version of my code:
Regarding the count, you can simply use a value script that is simply "1".
Regarding the terms stats on multiple key fields, you can simply have several terms stats facets, each on different field. Or are you looking for something different?
On Thursday, March 24, 2011 at 12:59 AM, eugene wrote:
Hi,
I got termsstats facet code working in Java for a single non-numeric
key field. The way I did this is I introduced a new numeric field
called "counter" that always has a value 1. Here is an example of curl
version of my code:
Wait, now I am a bit confused :), why use term stats to get how many times a term occurs, you can just use the terms facet, no?
On Thursday, March 24, 2011 at 1:05 AM, Shay Banon wrote:
Regarding the count, you can simply use a value script that is simply "1".
Regarding the terms stats on multiple key fields, you can simply have several terms stats facets, each on different field. Or are you looking for something different?
On Thursday, March 24, 2011 at 12:59 AM, eugene wrote:
Hi,
I got termsstats facet code working in Java for a single non-numeric
key field. The way I did this is I introduced a new numeric field
called "counter" that always has a value 1. Here is an example of curl
version of my code:
I am looking for grouping fields, equivalent to sql query "select
field1, field2, sum(counter) from my_table group by field1, field2",
which implies that I need to have 2 key fields under the same facet.
Regarding the count, you can simply use a value script that is simply "1".
Regarding the terms stats on multiple key fields, you can simply have several terms stats facets, each on different field. Or are you looking for something different?
On Thursday, March 24, 2011 at 12:59 AM, eugene wrote:
Hi,
I got termsstats facet code working in Java for a single non-numeric
key field. The way I did this is I introduced a new numeric field
called "counter" that always has a value 1. Here is an example of curl
version of my code:
So, you want to get counts for tuples of field1 and field2? You can do that using terms stats and script field, by creating a script that combined the two: doc['field1'].value + "_" + doc['field2'].value. Not amazing in terms of perf because of the string generation, but, might be good for you.
On Thursday, March 24, 2011 at 1:08 AM, eugene wrote:
I am looking for grouping fields, equivalent to sql query "select
field1, field2, sum(counter) from my_table group by field1, field2",
which implies that I need to have 2 key fields under the same facet.
Regarding the count, you can simply use a value script that is simply "1".
Regarding the terms stats on multiple key fields, you can simply have several terms stats facets, each on different field. Or are you looking for something different?
On Thursday, March 24, 2011 at 12:59 AM, eugene wrote:
Hi,
I got termsstats facet code working in Java for a single non-numeric
key field. The way I did this is I introduced a new numeric field
called "counter" that always has a value 1. Here is an example of curl
version of my code:
So, you want to get counts for tuples of field1 and field2? You can do that using terms stats and script field, by creating a script that combined the two: doc['field1'].value + "_" + doc['field2'].value. Not amazing in terms of perf because of the string generation, but, might be good for you.
On Thursday, March 24, 2011 at 1:08 AM, eugene wrote:
I am looking for grouping fields, equivalent to sql query "select
field1, field2, sum(counter) from my_table group by field1, field2",
which implies that I need to have 2 key fields under the same facet.
Regarding the count, you can simply use a value script that is simply "1".
Regarding the terms stats on multiple key fields, you can simply have several terms stats facets, each on different field. Or are you looking for something different?
On Thursday, March 24, 2011 at 12:59 AM, eugene wrote:
Hi,
I got termsstats facet code working in Java for a single non-numeric
key field. The way I did this is I introduced a new numeric field
called "counter" that always has a value 1. Here is an example of curl
version of my code:
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.