I mean like mysql query

select count( distinct id ) from tablename;

Thanks

Nick Chang於 2014年2月27日星期四UTC+8下午2時51分39秒寫道:
>
> Hello
>
> I want to analysis " who read the how many books?"
>
> When bookid is duplicate, I don't want to count.
>
> POST /bookdatas/_search
> {
>     "size": 0,
>     "facets": {
>         "ips_stats": {
>             "terms_stats": {
>                 "key_field": "userId",
>                 "value_field": "duration",
>                 "size": 5
>             },
>       "facet_filter": {
>         "fquery": {
>           "query": {
>             "filtered": {
>               "query": {
>                 "bool": {
>                   "should": [
>                     {
>                       "query_string": {
>                         "query": "\"(Google)[email protected]\""
>                       }
>                     }
>                   ]
>                 }
>               }
>             }
>           }
>         }
>       }
>         }
>     }
> }
>
> result 
>  "facets": {
>       "ips_stats": {
>          "_type": "terms_stats",
>          "missing": 0,
>          "terms": [
>             {
>                "term": "(Google)[email protected]",
>                "count": 64,
>                "total_count": 3,
>                "min": 2,
>                "max": 139436,
>                "total": 140733,
>                "mean": 46911
>             },
>
>
> userId  prdId  duration  chapId(Google)[email protected](Google)
> [email protected](Google)[email protected]
> A user only read a book, but count is three.
>
> Can you give me a suggestion??
>
> 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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/8accddc1-9c11-459b-b384-f2b430af39ac%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to