Total number of clicks of one document

Hi everyone,
I'm struggling with getting the total number of clicks of one document. As I see here Analytics clicks API | Elastic App Search Documentation [7.14] | Elastic, we only can get the total number of clicks in one query. So for example, we have one document which is SHOE-1, it's clicked 3 times in A query, 2 times in B query, so how could we get the total number of clicks which is 5 in all queries?

Thank you.

Hi @ntruongsinh ,

if you're looking to see analytics related to a single document, you need to use the counts endpoint (not the clicks). See example in documentation here that does exactly what you want:

Request would look like this:

curl -XGET "http://<ENT-SEARCH-URL>/api/as/v1/engines/national-parks-demo/analytics/counts" \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <private-KEY-HERE>'\
-d '{filters: {"document_id": "12345"}}'


Wow, thank you so much @Irina_Truong , I was not aware of this. However, one more concern @Irina_Truong , it tells us that we could only get the clicks in maximum 100 days in one call, is that right? So it means that we have to trigger other calls if we want more days.

Yes, this is true. I filed an enhancement ticket to ask for this query of yours to be supported in later versions. It feels like it might be a useful feature to have.

1 Like