Grafana JSON API datasource - parse response - grafana

I succesfully get data from datasource using plugin: https://grafana.github.io/grafana-json-datasource/
And my response looks like this (I see that in Chrome console log):
{
"count": 4,
"results": [
{
"time": "2022-12-06T17:52:30.142Z",
"deviceId": "3021EF",
"humidity": 49,
"messageId": "1ed82601-e98a-4b78-a580-0c8a5ddd1e99"
},
{
"time": "2022-12-06T17:52:30.142Z",
"humidity": 45,
"deviceId": "3021EF",
"messageId": "1ed82601-e98a-4b78-a580-0c8a5ddd1e98"
},
{
"time": "2022-12-06T18:27:34.768Z",
"deviceId": "3021EF",
"humidity": 49,
"messageId": "1ed82601-e98a-4b78-a580-0c8a5ddd1e97"
},
{
"time": "2022-12-06T18:27:34.768Z",
"deviceId": "3021EF",
"temperature": 21.6,
"messageId": "1ed82601-e98a-4b78-a580-0c8a5ddd1e96"
}
],
"fields": [
"time",
"deviceId",
"humidity",
"messageId"
]
}
But I can not parse this data using explore:
What is wrong?

Related

Strapi multi-level population with field selection

I want to populate a multilevel relational field on strapi with REST API with specific field selection, but only the id comes up at the response.
When I populate the field without field selections with a GET request at: localhost:1337/api/home?populate[0]=Reasons&populate[1]=Reasons.IconsList&populate[2]=Reasons.IconsList.Icon, I
get this JSON response:
{
"data": {
"id": 1,
"attributes": {
"createdAt": "2022-10-31T11:24:55.202Z",
"updatedAt": "2022-11-09T13:50:40.445Z",
"publishedAt": "2022-10-31T11:26:30.944Z",
"PageInfo": "Homepage",
"Reasons": {
"id": 1,
"IconsList": [
{
"id": 1,
"Content": "Free cancellation on most bookings",
"Icon": {
"data": {
"id": 3,
"attributes": {
"name": "cancellation.svg",
"alternativeText": "Free cancellation on most bookings",
"caption": "cancellation.svg",
"width": 21,
"height": 21,
"formats": null,
"hash": "cancellation_b2308d4b63",
"ext": ".svg",
"mime": "image/svg+xml",
"size": 1.57,
"url": "/uploads/cancellation_b2308d4b63.svg",
"previewUrl": null,
"provider": "local",
"provider_metadata": null,
"createdAt": "2022-10-20T12:02:37.735Z",
"updatedAt": "2022-10-31T11:23:48.326Z"
}
}
}
},
{
"id": 2,
"Content": "No credit card fees",
"Icon": {
"data": {
"id": 5,
"attributes": {
"name": "credit-card.svg",
"alternativeText": "credit-card.svg",
"caption": "credit-card.svg",
"width": 22,
"height": 16,
"formats": null,
"hash": "credit_card_06b9eca40f",
"ext": ".svg",
"mime": "image/svg+xml",
"size": 0.89,
"url": "/uploads/credit_card_06b9eca40f.svg",
"previewUrl": null,
"provider": "local",
"provider_metadata": null,
"createdAt": "2022-10-20T12:21:46.342Z",
"updatedAt": "2022-10-20T12:21:46.342Z"
}
}
}
},
{
"id": 3,
"Content": "24/7 Customer care",
"Icon": {
"data": {
"id": 2,
"attributes": {
"name": "customer-care.svg",
"alternativeText": "24/7 Customer care",
"caption": "customer-care.svg",
"width": 20,
"height": 22,
"formats": null,
"hash": "customer_care_6aa8ac8eea",
"ext": ".svg",
"mime": "image/svg+xml",
"size": 1.48,
"url": "/uploads/customer_care_6aa8ac8eea.svg",
"previewUrl": null,
"provider": "local",
"provider_metadata": null,
"createdAt": "2022-10-20T12:02:37.734Z",
"updatedAt": "2022-10-20T12:04:39.792Z"
}
}
}
}
]
}
}
},
"meta": {}
}
Following this guide: https://docs.strapi.io/developer-docs/latest/developer-resources/database-apis-reference/rest/populating-fields.html#combining-population-with-other-operators, when I try to define the fields I want from the response: localhost:1337/api/home?fields[0]=PageInfo&populate[Reasons][IconsList]fields]=Content, I only get this JSON:
{
"data": {
"id": 1,
"attributes": {
"PageInfo": "Homepage",
"Reasons": {
"id": 1
}
}
},
"meta": {}
}
I want to get IconsList's Content and Icon.alternativeText and Icon.url but I cannot find how to build my query parameters.
For future reference to this problem, my question was answered on Strapi forum: https://forum.strapi.io/t/strapi-multi-level-population-with-field-selection/23473
This tutorial explains the reasoning behind deep populating and filtering and it's really interesting.
The problem was that you need to pupulate the relational field again like that: localhost:1337/api/home?fields[0]=PageInfo&populate[Reasons][populate][IconsList][fields][0]=Content to be able to access its data.

KAFKA connector Apply Tansform.filter.Value

I have create a connector to azureEventhub , it works fine to pull the data into the topic ,
My use case is to filter the messages that I m pullling basing on the message type .
Example :
{
"messageType": "Transformed",
"timeStamp": 1652113146105,
"payload": {
"externalId": "24323",
"equipmentType": "TemperatureSensor",
"measureType": "Temperature",
"normalizedData": {
"equipmentData": [
{
"key": "ReadingValue",
"value": 23,
"valueType": "number",
"measurementUnit": "celsius",
"measurementDateTime": "2022-05-09T16:18:34.0000000Z"
}
]
},
"dataProviderName": "LineMetrics"
},
},
{
"messageType": "IntegratorGenericDataStream",
"timeStamp": 1652113146103,
"payload": {
"dataSource": {
"type": "sensor",
},
"dataPoints": [
{
"type": "Motion",
"value": 0,
"valueType": "number",
"dateTime": "2022-05-09T16:18:37.0000000Z",
"unit": "count"
}
],
"dataProvider": {
"id": "ba84cbdb-cbf8-4d4f-9a55-93b43f671b5a",
"name": "LineMetrics",
"displayName": "Line Metrics"
}
},
}
I wanted to apply a filter on a value like shown in the pic:
enter image description here
the error that appears to me :
enter image description here

mongoDb: aggregate document references to subgroups

I've a set of BSON documents in a mongoDb collection which I want to process according to form cascading sub-documents. There are thousand of duplicate id's only to be differentiated by timestamps and documents with type subsystem-> component -> subcomponent; and they should be attached to each other based on source. This is a sample I currently have:
[{
"id": 1001,
"type": "subsystem",
"time": 1454767739,
"payload": {
"key": "..."
}
},
{
"id": 1001,
"type": "subsystem",
"time": 1454767539,
"payload": {
"key": "..."
}
},
{
"id": 2001,
"type": "component",
"time": 1454767778,
"source": 1001,
"payload": {
"key": "..."
}
},
{
"id": 5002,
"type": "subcomponent",
"time": 1454767779,
"source": 2001,
"payload": {
"key": "..."
}
},
{
"id": 5003,
"type": "subcomponent",
"time": 1454767798,
"source": 2001,
"payload": {
"key": "..."
}
}]
And what am I trying to do is this:
match all elements with a timestamp lower than a maxTime value
group all elements by (unique) id, but only use the newest value ($max: $time) for $$ROOT (every id is unique now)
group all by attribute source as a array to the element with that id (or _id)
I've achieved 1.) and 2.) already have this group:
[{
"_id": 1001,
"reftime": 1454767739,
"element": [
{
"id": 1001,
"type": "subsystem",
"time": 1454767739,
"payload": {
"key": "..."
}
}
]
},
{
"_id": 2001,
"reftime": 1454767778,
"element": [
{
"id": 2001,
"type": "component",
"time": 1454767778,
"source": 1001,
"payload": {
"key": "..."
}
}
]
},
{
"_id": 5002,
"reftime": 1454767779,
"element": [
{
"id": 5002,
"type": "subcomponent",
"time": 1454767779,
"source": 2001,
"payload": {
"key": "..."
}
}
]
},
{
"_id": 5003,
"reftime": 1454767798,
"element": [
{
"id": 5003,
"type": "subcomponent",
"time": 1454767798,
"source": 2001,
"payload": {
"key": "..."
}
}
]
}]
But what I want is the elements to be structured according to their links in the source value. So it would look something like this:
{
"_id": 1001,
"reftime": 1454767739,
"element": [
{
"id": 1001,
"type": "subsystem",
"time": 1454767739,
"payload": {
"key": "..."
}
}
],
"attached": [
{
"_id": 2001,
"reftime": 1454767778,
"element": [
{
"id": 2001,
"type": "component",
"time": 1454767778,
"source": 1001,
"payload": {
"key": "..."
}
}
],
"attached": [
{
"_id": 5002,
"reftime": 1454767779,
"element": [
{
"id": 5002,
"type": "subcomponent",
"time": 1454767779,
"source": 2001,
"payload": {
"key": "..."
}
}
]
},
{
"_id": 5003,
"reftime": 1454767798,
"element": [
{
"id": 5003,
"type": "subcomponent",
"time": 1454767798,
"source": 2001,
"payload": {
"key": "..."
}
}
]
}
]
}
]
}
Is this possible? I'm struggling to form a group with everything that has a source and combine this with the group from sample 2.). Or if that would help, I could introduce a source: 0? for every subsystem and group by that under a single root element?
Any ideas or insights? I'm currently stuck at this point. Thank you!

Domino 9.x calendar service create meeting

I have been following this guide to work on Domino 9.0.1
Domino Calendar services
I am using JSON and the POST command works but creates an appointment, what I want to do is create a meeting. I have tried setting other fields like event['x-lotus-appttype'].data or event.AppointmentType = 3 but I still get an appointment.
JSON I am sending
{
"events": [
{
"summary":"Meeting 1",
"location":"Location 1",
"start": {
"date":"2013-12-01",
"time":"13:00:00",
"utc":true
},
"end": {
"date":"2013-12-01",
"time":"14:00:00",
"utc":true
}
}
]
}
What is the correct JSON format to create a meeting ?
Take a look at the following documentation: Event with attendees represented in JSON format
EXAMPLE 4. Event with attendees and time zone array:
{
"x-lotus-charset": {
"data": "UTF-8"
},
"timezones": [
{
"tzid": "Eastern",
"standard": {
"start": {
"date": "1950-11-05",
"time": "02:00:00"
},
"offsetFrom": "-0400",
"offsetTo": "-0500",
"recurrenceRule": "FREQ=YEARLY;BYMONTH=11;BYDAY=1SU;BYHOUR=2;BYMINUTE=0"
},
"daylight": {
"start": {
"date": "1950-03-12",
"time": "02:00:00"
},
"offsetFrom": "-0500",
"offsetTo": "-0400",
"recurrenceRule": "FREQ=YEARLY;BYMONTH=3;BYDAY=2SU;BYHOUR=2;BYMINUTE=0"
}
}
],
"events": [
{
"href": "/mail/dlawson.nsf/api/calendar/events/DB7E0BAC21EC322A85257BD200756E26-Lotus_Notes_Generated",
"id": "DB7E0BAC21EC322A85257BD200756E26-Lotus_Notes_Generated",
"summary": "Staff meeting",
"location": "Ray's office",
"description": "Please email your status update 24 hours before the meeting.",
"start": {
"date": "2013-09-12",
"time": "09:00:00",
"tzid": "Eastern"
},
"end": {
"date": "2013-09-12",
"time": "10:00:00",
"tzid": "Eastern"
},
"class": "public",
"transparency": "opaque",
"sequence": 0,
"last-modified": "20130825T212457Z",
"attendees": [
{
"role": "chair",
"status": "accepted",
"rsvp": false,
"displayName": "Duke Lawson/Peaks",
"email": "DukeLawson#swg.usma.ibm.com"
},
{
"role": "req-participant",
"status": "needs-action",
"rsvp": true,
"displayName": "Dean Melnyk/Peaks",
"email": "DeanMelnyk#swg.usma.ibm.com"
},
{
"role": "req-participant",
"status": "needs-action",
"rsvp": true,
"displayName": "Raymond Chan/Peaks",
"email": "RaymondChan#swg.usma.ibm.com"
}
],
"organizer": {
"displayName": "Duke Lawson/Peaks",
"email": "DukeLawson#swg.usma.ibm.com"
},
"x-lotus-broadcast": {
"data": "FALSE"
},
"x-lotus-notesversion": {
"data": "2"
},
"x-lotus-appttype": {
"data": "3"
}
}
]
}
I hope this can help :)

Elasticsearch nested query

I'm new to elasticsearch, managed to set it up and import recordset from my mongodb collection using the river plugin. For a start, I want to query against the "desc" field but just can't manage to get the query .. not sure if the problem is driven by the way index was defined.. can anyone help please?
Sample recordset in elastic search looks like this
{
"took": 2,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 107209,
"max_score": 1,
"hits": [
{
"_index": "shiv",
"_type": "shiv",
"_id": "iG1eIzN7RGO7hFfxTlnLuA",
"_score": 1,
"_source": {
"_id": {
"$oid": "50901d7f485bf7bd1c000021"
},
"brand": "",
"category": {
"$ref": "categories",
"$id": {
"$oid": "4fbd2221758cb11d14000174"
}
},
"comments": [],
"count_comment": 0,
"count_fav": 2,
"count_hotness": 1.46,
"count_rekick": 0,
"count_share": 0,
"country": {
"$ref": "countries",
"$id": {
"$oid": "4fec98f7758cb18c6e0002c9"
}
},
"currency": "pound",
"desc": "A men's automatic watch, this Seamaster Bond model features a Co-Axial escapement and date function. Its blue dial is teamed with a stainless steel case and bracelet for a look that's sporty and refined.",
"gender": "male",
"ident": "omega-seamaster-diver-bond-men-s-automatic-watch---ernest-jones-1351622015",
"img_url": "http://s7ondemand4.scene7.com/is/image/Signet/5735793?$detail$",
"lifestyles": [
{
"$ref": "lifestyles",
"$id": {
"$oid": "508ff6ca485bf73112000060"
}
}
],
"location": "United Kingdom",
"owner": {
"$ref": "accounts",
"$id": {
"$oid": "50742fd8485bf74b7a00213f"
}
},
"price": 2400,
"store": "ernestjones.co.uk",
"tags": [
"ernest-jones",
"bond"
],
"timestamp_creation": 1351622015,
"timestamp_exp": 1356825600,
"timestamp_update": 1351622015,
"title": "Omega Seamaster Diver Bond men's automatic watch - Ernest Jones",
"url": "http%3A%2F%2Fwww.ernestjones.co.uk%2Fwebstore%2Fd%2F5735793%2Fomega%20seamaster%20diver%20bond%20men%27s%20automatic%20watch%2F%3Futm_source%3Dgooglebase%26utm_medium%3Dfeedmanager%26cm_mmc%3DFroogle-_-CKB-_-nurses_fobs-_-watches%26cm_mmca1%3Domega%26cm_mmca2%3Dmale%26cm_mmca3%3Dadult"
}
}
]
}
}
The mapping of the index "shiv" looks like
{
"shiv": {
"properties": {
"$oid": {
"type": "string"
}
}
}
}
Thanks again
There are lots of ways to query, have you tried a match query?
Using curl or a rest client of your choice...
http://[host]:9200/[index_name]/[doc_type]/_search
{
"query" : {
"match" : {
"desc" : "some value you want to find in desc"
}
}
}