I'm trying to construct the following SQL query in Elasticsearch: SELECT companyId, COUNT(*) c FROM visits GROUP BY companyId ORDER BY c DESC LIMIT 2
I came up with the following JSON body for the query: { "facets": { "company": { "filter": { "term": { "entityType": "companypage" } }, "terms": { "field": "entityId", "size": 2 } } } } When I use "size": 2, I get the following result: facets: { company: { _type: terms missing: 0 total: 4 other: 0 terms: [{ term: 2 count: 3 }, { term: 20 count: 1 }] } } When I use "size": 1, I get the following result: facets: { company: { _type: terms missing: 0 total: 4 other: 2 terms: [{ term: 2 count: 2 }] } } How is it possible that the count for term 2 is 3 in the first response, but 2 in the second response? -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/45ccf14f-81f2-4a9e-b598-6eb120f46197%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.