Below is the input JSON array and I'm expecting non identical object which is not present in the second array in the output.
JSON Path version I'm using: 2.7.0
{
"first": [
{
"id": "1"
},
{
"id": "2"
},
{
"id": "4"
}
],
"second": [
{
"id": "1"
},
{
"id": "2"
},
{
"id": "3"
}
]
}
Expected output :
[
{
"id": "3"
}
]
Related
I know how to compose JSON when you want to create a single document on FireStore.
# Query String
"updateMask.fieldPaths": [
"`price`",
"`status`"
]
# Body
"fields": {
"price": {
"stringValue": "165.00"
},
"status": {
"stringValue": "active"
}
}
But when it comes to BatchWrite I cannot understand what the doc implies
https://cloud.google.com/firestore/docs/reference/rest/v1/projects.databases.documents/batchWrite
Currently I'm doing this with Python library I deployed on cloud computing resource(pipedream) but I want to do this within Make.com and its "Make API Call" module so I need to know the curl style or REST JSON syntax.
I'm assuming fields go to "writes" but not sure what goes to "labels" object.
Exactly what's the write structure for this call?
{
"writes": [
{
"update": {
"name": "projects/project_id/databases/(default)/documents/service_order/352003090342435.5f357270173e8c70878.-9486573",
"fields": {
"managed_by": {
"booleanValue": "false"
},
"location2": {
"booleanValue": "false"
},
"made_by": {
"stringValue": "352003090342435.5eda4f3c17284c58460.90921842"
},
"phone2": {
"stringValue": "0665439307"
},
"state": {
"stringValue": "confirm"
},
"write_date": {
"stringValue": "1597664391000"
},
"made_by_name": {
"stringValue": "FaridBenabdallah"
},
"description": {
"stringValue": "e1"
},
"accepted_offer": {
"booleanValue": "false"
},
"id": {
"stringValue": "352003090342435.5f357270173e8c70878.-9486573"
},
"location1": {
"stringValue": "352003090342435.5f3572a0173e8c7c336.-8281409"
},
"date_order": {
"booleanValue": "false"
},
"order_type": {
"stringValue": "Minuiserie"
},
"phone1": {
"stringValue": "0657331995"
}
}
},
"updateMask": {
"fieldPaths": [
"managed_by",
"location2",
"made_by",
"phone2",
"state",
"write_date",
"made_by_name",
"description",
"accepted_offer",
"id",
"location1",
"date_order",
"order_type",
"phone1"
]
}
}
]
}
This another stackoverflow article helped me
If there is null you need to change the intended value type to nullValue.
I'm having to make 2 runRealtimeReport requests, one to get the device category and another to get the list of the most accessed pages.
What I would like to get is the general amount of hits to the site via mobile, desktop and tablet, but including the two dimensions, return the pages and the device category of each access.
If I include the deviceCategory and unifiedScreenName dimensions in the same request, the data is grouped as shown in the example below:
Request body:
{
"metrics": [
{
"name": "activeUsers"
}
],
"dimensions": [
{
"name": "deviceCategory"
},
{
"name": "unifiedScreenName"
}
],
"limit": 2
}
Response:
{
"dimensionHeaders": [
{
"name": "deviceCategory"
},
{
"name": "unifiedScreenName"
}
],
"metricHeaders": [
{
"name": "activeUsers",
"type": "TYPE_INTEGER"
}
],
"rows": [
{
"dimensionValues": [
{
"value": "mobile"
},
{
"value": "Title page 01"
}
],
"metricValues": [
{
"value": "9"
}
]
},
{
"dimensionValues": [
{
"value": "mobile"
},
{
"value": "Title Page 2"
}
],
"metricValues": [
{
"value": "3"
}
]
}
],
"rowCount": 16,
"kind": "analyticsData#runRealtimeReport"
}
I'm working with ElasticSearch (on a Symfony 4 project with FosElasticaBundle) and I don't know how can I build a query like :
Match if value in list of values
I have a field "code" and I need to retrieve an element ONLY if the value of this field "code" is : "first or "second" or "third"
I tried with terms :
Must query : nothing is retrieved, maybe must is "first AND "second" AND "third" ?
Should query : Everything is retrieved, even if I have another value than "first or "second" or "third", so shoul query is useless ?
I tried with Match (should, must) or term one by one... nothing...
So, how can I do that in elasticsearch ? Thanks !
PUT some-test
PUT /some-test/doc/1
{
"foo": "first"
}
PUT /some-test/doc/2
{
"foo": "second"
}
PUT /some-test/doc/3
{
"foo": "fourth"
}
POST some-test/_search
{
"query": {
"bool": {
"must": [
{
"match": {
"foo": "first second third"
}
}
]
}
}
}
gives me
{
"took": 4,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"skipped": 0,
"failed": 0
},
"hits": {
"total": 2,
"max_score": 0.2876821,
"hits": [
{
"_index": "some-test",
"_type": "doc",
"_id": "2",
"_score": 0.2876821,
"_source": {
"foo": "second"
}
},
{
"_index": "some-test",
"_type": "doc",
"_id": "1",
"_score": 0.2876821,
"_source": {
"foo": "first"
}
}
]
}
}
I'm trying to use the Google cloud datastore command line interface to create arrays of embedded entities. I've figured out how to create an embedded entity value as follows:
{
"properties": {
"age": {
"integerValue": "5"
},
"height": {
"integerValue": "6"
}
}
}
and how to create an array value as follows:
{
"values": [
{
"stringValue": "one"
},
{
"stringValue": "two"
}
]
}
But I haven't figured out how to add an embedded value to an array. For example:
{
"values": [
{
"stringValue": "one"
},
{
"stringValue": "two"
},
{
"embeddedEntityValue": {
"properties": {
"age": {
"integerValue": "5"
},
"height": {
"integerValue": "6"
}
}
}
}
]
}
gives the error:
"One or more values in this array doesn't look right. If you include values, make sure they are Datastore array values in JSON format."
I believe embeddedEntityValue should be changed to entityValue. Below is an example that shows an Array field with two embedded entities:
{
"values": [
{
"entityValue": {
"properties": {
"areaCode": {
"stringValue": "40"
},
"countryCode": {
"stringValue": "91"
},
"subscriberNumber": {
"stringValue": "2722 5858"
}
}
}
},
{
"entityValue": {
"properties": {
"countryCode": {
"stringValue": "91"
},
"subscriberNumber": {
"stringValue": "6666 0000"
},
"areaCode": {
"stringValue": "80"
}
}
}
}
]
}
Hello I have the following scenario:
JSON object:
{
"$id": "1",
"someProp": "123",
"children": [{
"$id": "2",
"$type": "ClassB",
"Parent": {
"$ref": "1"
}
}]
}
JSON schema :
{
"id": "ClassA",
"required": true,
"type": [
"object",
"null"
],
"properties": {
"someProp": {
"required": true,
"type": [
"string",
"null"
]
},
"children": {
"id": "List<Child>",
"required": true,
"type": [
"array",
"null"
],
"items": {
"id": "Child",
"type": [
"object",
"null"
],
"properties": {
"id": {
"required": true,
"type": "integer"
},
"parent": {
"$ref": "ClassA"
}
}
}
}
}
}
I have a complex object who has reference loops, so I have configured json.net to make reference when the object is serialized. Everything is working as expected I can serialize and deserialize the object, but when I am validating the JSON object with the above schema I got the following error :
Required properties are missing from object : "someProp", path :
object.Children[0].parent
And that is correct how can make the schema look at the reference JSON object ?
Problem is with the "id" property of an object inside children array
"properties": {
"id": {
"required": true,
"type": "integer"
},
"parent": {
"$ref": "ClassA"
}
}
You are saying id requires to have property "id" and you don't have that property inside object, either changes "id" to "$id" or remove it from property list to satisfy schema.
"properties": {
"$id": {
"required": true,
"type": "integer"
},
"parent": {
"$ref": "ClassA"
}
}
Also make sure you have "id" / "$id" integer value, i.e.
"$id":2 not "$id":"2"