Group by with count distinct on a string field


(Fabien Guiraud) #1

Hi,

I have a big problem with ES : I want to do a group by and I want to count
distinct on a value (string value)

I tried with TermStats but it seems it doesn't support string as value...

any idea?

If it can help, my model :

table

field_id
field_a (string)
field_b (array of ids)
field_c (count)

In a SQL way, I want : "SELECT sum(field_c), COUNT(DISTINCT(field_a)) FROM
table GROUP BY field_b

I have no problem with SUM(field_c) with TermStats, but impossible to do
the same thing with a string value, I have an error : 'field_a is not a
number'

Thanks

--
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.


(system) #2