I am using Google analytics events to track what users are searching for within a particular dataset on a single page (the value of an input box when they click search).
I am accessing the real time events using the 'Real Time Reporting API' using the metric rt:totalEvents and the dimension rt:eventLabel. When I query the data I get a response such as:
["Los Angeles, CA",
"37"
],
[
"San Francisco, CA",
"29"
],
[
"Las Vegas, NV",
"21"
],
I doubt these figures are be the number of events at the exact time of the query, each event must stay current for a period of time, what is this time frame?
Thank you in advance for your assistance.
if memory serves its the last five minutes. However you can easily find out by adding rt:minutesAgo to your request.
OK, I did a little testing and it turns out that the 'real time' events stay current for 30 minutes.
Thanks #DalmTo for recommending the "rt:minutesAgo" dimension as that is very useful!
Related
To create a new point a time we do
POST /my-index-000001/_pit?keep_alive=1m
output:
{
"id": "46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIgAAAAA=="
}
It will return a PIT ID.
Now to get the total number of open search, we do
GET /_nodes/stats/indices/search
and output has
"open_contexts" : 18,
As Elastic says that we should close/delete the PIT after the work is done. Close the Point in time
Now the question:
how can we get ids of all open search or PITs?
if we can not get the Ids, is there any way to close the search after a time or it is auto-closed after keep-alive time ended.
I am not able to find any documentation regarding this.
There's no way to do retrieve the IDs of the opened search contexts, you're supposed to keep track of them in your application code.
As the link you provided states:
Point-in-time is automatically closed when its keep_alive has been elapsed.
So in your case, if you don't issue a new query after 1 minute, then the search context will be automatically closed.
I'm currently working with mailbox messages using Graph API. I want to know what does the time in attribute "createdDateTime" indicates?. I'm finding that the attribute "sentDateTime" is ahead for few seconds or equal to "createdDateTime" for a mailbox message.
Graph API response of message:
"createdDateTime": "2021-06-17T13:02:21Z"
"sentDateTime": "2021-06-17T13:02:22Z"
Another response:
"createdDateTime": "2021-06-15T01:56:13Z"
"sentDateTime": "2021-06-15T01:56:13Z"
Another response:
"createdDateTime": "2021-06-15T01:52:30Z"
"sentDateTime": "2021-06-15T01:52:15Z"
It stands for the date and time of item creation. It seems items were sent out automatically by any software or macros.
This is a race condition. One states the date/time the message was sent over the wire, the other is the date/time the message was written to Exchange. If there is any delay between these two events, it could easily cause the two values to look like they're a full second off.
I say "looks like" because the resolution here is only to a second. If you increased the resolution to factional seconds, I suspect you'd find T13:02:21 was moments from flipping over to T13:02:22. In other words, they may actually only be fractionally apart rather than a full second.
When I index a document in ES, I am trying to access the same document within in the refresh interval has passed and the search is not returning the result. Is there a Realtime GET support which allows to get a document once indexed regardless of the "refresh rate" of the index. I tried reducing the refresh_interval to 500ms instead of 1s, but my search query happens even before 500 ms and it is not a good idea to reduce it even further.
After indexing a document, you can GET it immediately without waiting for the refresh interval.
The GET API is real-time
So if you index a new document like this
POST index/type/1
{ "name": "John Doe" }
You can get it immediately without waiting using
GET index/type/1
If you search, however, you'll need to wait for the refresh interval to pass in order to retrieve the new document or call the refresh API.
For completeness' sake, it's worth stating that when indexing you also have the option of refreshing the shards immediately, by passing the refresh=true parameter like below. Note, however, that this can have bad performance implications, so it should be used sparingly.
POST index/type/1?refresh=true
{ "name": "John Doe" }
Also worth noting that in ES 5, you'll have the option of telling ES to wait for a refresh before returning from the create call:
POST index/type/1?refresh=wait_for
{ "name": "John Doe" }
In this case, once the POST request returns, you're guaranteed that the new document is available in the next search call.
I'm very new to APIs, Java and all this things.
I Googled and over-googled things about the Google Analytics API and found very few answers. So I thought I'd post my question here.
The ga:avgSessionDuration returns the average sessions duration on my sites. But it returns in seconds and miliseconds. I want that number divided by 60 so I'll se minutes (as I see it on the Google Analytics website). But I have no clue how to do that and found no answer on Google.
Here is my code:
'dimensions': 'ga:yearMonth',
'metrics': 'ga:users,ga:pageviews,ga:avgSessionDuration',
'start-date': '2014-01-02',
'end-date': 'today',
'max-results': '12',
'sort': '-ga:yearMonth',
The return info is:
Month of Year Users Pageviews Avg. Session Duration
201505 18 25 27.894736842105264
201504 475 685 38.3062381852552
Another thing I hate is that the Months are printed out as "201505" instead of "May 2015".
Cheers. :)
As you can see from the documentation:
ga:avgSessionDuration
Web View Name: Avg. Session Duration The
average duration of user sessions represented in total seconds.
ga:sessionDuration / ga:sessions
The Reporting API returns the data to you in seconds. This is to make it easer for all developers to then format the information as they wish. You as a developer will need to loop though the results add your divide by 60 in order to format your data in minutes.
Google returns raw data formatting is up to us.
The same goes for Month of Year the standard format is YYYYMM you will need to format the data in your code.
My code fetches calendar events using service.events().list() with the following parameters:
timeMax: 2015-11-13T04:12:44.263000Z
timeMin: 2014-05-17T04:12:44.263000Z
updatedMin: 2014-11-12T14:56:20.395000Z # = yesterday
I know there's a limit on the updatedMin param that prevents it to be too far in the past, but lately I get the following error even when updatedMin is yesterday:
The requested minimum modification time lies too far in the past.
Everywhere this error is mentioned, they are talking about a limit that is approx. 20 days in the past, certainly not one day.
Any ideas what is causing this error?
#Tzach, I tried the above query in API explorer with the same values and it returned the results without any error unless its greater than 20days. As Luc said, better to switch to syncTokens which saves the bandwidth.