Does Keen.io have a keyword or limit equivalent?

Everything,

Using Keen.io, pull out some analytics. I allow the user to enter start and end times, but I cannot find something equivalent to the "limit" parameter, for example, which can be found for SQL queries. If the user sets a sufficiently large range, this may result in too much data being returned.

Does Keen.io have a way to undo the first x entries?

bower.json

"keen-js": "^3.4.1",

+5
source share
2 answers

A new Keen IO API function has appeared, which allows you to limit the query result to get your “best results” and have results sorted in ascending or descending order. order_by works similarly to the currently existing group_by function - you will call order_by in your request.

Define direction to sort all of your query results in either ASC or descending order (default ascending order). And use limit to tell the API the number of results you would like to return - be it your 5 or 5 results.

The order of the documents: https://keen.io/docs/api/#order-by

Here's a JavaScript example to illustrate the recently added order_by API function:

 import Keen from 'keen-js'; const client = new Keen({ projectId: 'PROJECT_ID', readKey: 'READ_KEY' }); client .query('count', { event_collection: 'logins', group_by: 'user.email', order_by: {'property_name': 'result', 'direction': 'DESC'}, limit: '5', //this limits your number of results timeframe: 'this_14_days' }) .then(res => { // Handle results }) .catch(err => { // Handle errors }); 

order_by and limit were requested by customers - thanks for the tip to help with the creation of the Keen IO API tools and features.

+3
source

Looking at the documents, it looks like the easiest way to limit the results over a timeframe is to group the results in [interval][1] s.

This is not an ideal solution in that you get grouped data instead of individual records, but you guarantee that the results are limited.

+1
source

Source: https://habr.com/ru/post/1273307/


All Articles