This message was deleted.
# community-help
s
This message was deleted.
j
Aggregations happens based on
analytics-flush-interval
and the aggregation key
X-TYPESENSE-USER-ID
. We consider unique search terms after a 4 second delay after the last keypress
Oh wait, let me refine that
✅ 1
a
@Jason Bosco Ah that's interesting, so all the queries with the same
X-TYPESENSE-USER-ID
will "collapse" into one, so to speak? And is that collapsing limited to the duration of
analytics-flush-interval
? Meaning that if
analytics-flush-interval
is, like, 5 seconds, If the same user (with the same
X-TYPESENSE-USER-ID
) sends the same query twice, once now, and once 10 seconds from now, that will increase the
count
by 2?
j
X-TYPESENSE-USER-ID
is used to group keypresses in a search-as-you-type experience. So for eg, if the user types in
term
one letter at a time, the search queries will show up to Typesense as:
t
,
te
,
ter
,
term
... Typesense will wait for 4s after the last query
term
for a given
X-TYPESENSE-USER-ID
and collapse the previous searches for `t,
te
and
ter
into
term
...
analytics-flush-interval
is actually independent from the the
4s
interval. flush interval is when the collected analytics logs are analyzed and the aggregation I mentioned above is performed across all users, across all search terms
If the same user (with the same X-TYPESENSE-USER-ID ) sends the same query twice, once now, and once 10 seconds from now, that will increase the count by 2?
That's correct. But, this is actually not based on analytics-flush-interval like I mentioned earlier (my bad - I edited that out), but based on a fixed 4s window.
So two search queries sent 4s apart will count as 2 searches
a
@Jason Bosco Oh okay, got it now. Thank you. So there isn't a throttling mechanism specifically for preventing abuse of this kind. The type of thing I was thinking about was more along the lines of having a limit for the amount of times the
count
of a query is incremented within N seconds/minutes/hours. So that, for example, even if there's a 1,000 requests for the same query within the span of 3 hours, all that just increments
count
by 1. So I'll probably have to use a custom collection for this that my app populates on its own, according to whatever custom heuristics it may have (given all the requests to Typesense actually go through our backend, it shouldn't be too difficult to implement this,) One last question: Is there a way to tell Typesense (e.g. via a query string parameter when sending a request to the search endpoint) that it should ignore that particular search in terms of analytics and not store its query in the queries collection?
j
having a limit for the amount of times the count of a query is incremented within N seconds/minutes/hours.
Typesense doesn't have this... But I think that will be a useful feature to support.
Is there a way to tell Typesense (e.g. via a query string parameter when sending a request to the search endpoint) that it should ignore that particular search in terms of analytics
This is not possible at the moment, but I was thinking about this myself recently. Could you create two GitHub issues, so we can track these?
✅ 1