Y-axis scale independent, with double shadow - vega-lite

Any questions about the use of reslove?,reslove independent & shared,facet reslove independent & shared,but looks not work.now Y-axis scale independent, with double shadowm,actually just need share the same Y-axis, code reproduce via this link https://vega.github.io/editor/#/edited
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"data": {"url": "data/cars.json"},
"facet": { "row": { "field": "Name"} },
"resolve": {
"axis": { "x": "independent", "y": "independent" }
},
"spec": {
"encoding": {
"x": { "field": "Cylinders", "type": "quantitative"},
"y": {
"type": "quantitative",
"scale": { "zero": true},
"axis": { "orient": "left"}
}
},
"layer":[
{
"mark": "bar",
"encoding": {
"y": {"field": "Acceleration", "type": "quantitative","aggregate":"count"}}
},
{
"mark": "bar",
"encoding": {
"y": {"field": "Acceleration", "type": "quantitative","aggregate":"sum"}}
}
],
"resolve": {
"scale": { "y": "independent" }
}
}}

Related

Parse JSON is raising this error inside some DoUntil iterations "Invalid type. Expected String but got Null."

I have the following schema inside my Parse JSON action inside Power Automate Flow:-
{
"type": "object",
"properties": {
"_id": {
"type": "object",
"properties": {
"$oid": {
"type": "string"
}
}
},
"normalized_otherCategory": {
"type": "string"
},
"category": {
"type": "string"
},
"otherCategory": {
"type": "string"
},
"location": {
"type": "string"
},
"referenceNumber": {
"type": "string"
},
"archivingDate": {
"type": "object",
"properties": {
"$date": {
"type": "string"
}
}
},
"actions": {
"type": "array",
"items": {
"type": "object",
"properties": {
"_id": {
"type": "object",
"properties": {
"$oid": {
"type": "string"
}
}
},
"type": {
"type": "string"
},
"user": {
"type": "string"
},
"timestamp": {
"type": "object",
"properties": {
"$date": {
"type": "string"
}
}
},
"normalized_comment": {
"type": "array"
},
"configs": {
"type": "array"
},
"comment": {
"type": "string"
}
},
"required": [
"_id",
"type",
"user",
"timestamp",
"normalized_comment",
"configs"
]
}
},
"otherAttributes": {
"type": "array"
},
"attributes": {
"type": "array"
},
"timestamp": {
"type": "object",
"properties": {
"$date": {
"type": "string"
}
}
},
"foundDate": {
"type": "object",
"properties": {
"$date": {
"type": "string"
}
}
},
"trainFoundAt": {
"type": "object",
"properties": {
"number": {
"type": "string"
},
"car": {
"type": "string"
},
"seat": {
"type": "string"
}
}
},
"status": {
"type": "string"
},
"matchIdNumber": {
"type": "string"
},
"__v": {
"type": "integer"
},
"imageData": {
"type": "object",
"properties": {
"originalName": {
"type": "string"
},
"contentType": {
"type": "string"
},
"data": {
"type": "object",
"properties": {
"$binary": {
"type": "string"
},
"$type": {
"type": "string"
}
}
}
}
},
"imageThumbData": {
"type": "object",
"properties": {
"originalName": {
"type": "string"
},
"contentType": {
"type": "string"
},
"data": {
"type": "object",
"properties": {
"$binary": {
"type": "string"
},
"$type": {
"type": "string"
}
}
}
}
},
"stationFoundAt": {
"type": "string"
}
},
"required": [
"_id",
"normalized_otherCategory",
"category",
"location",
"referenceNumber",
"archivingDate",
"actions",
"otherAttributes",
"attributes",
"timestamp",
"foundDate",
"status",
"matchIdNumber",
"__v"
]
}
but it is raising this error on 5% of the items, while working well for the other 95% items:-
{
"errors": [
{
"message": "Invalid type. Expected String but got Null.",
"lineNumber": 0,
"linePosition": 0,
"path": "stationFoundAt",
"schemaId": "#/properties/stationFoundAt",
"errorType": "type",
"childErrors": []
}
]
}
here is a sample of one of the inputs which is raising this error:-
{
"content": {
"_id": {
"$oid": "5daa037cb66a2c601510e8aa"
},
"normalized_otherCategory": "purse,type,wallet",
"category": "other",
"otherCategory": "Purse-Type Wallet",
"location": "ontrain",
"referenceNumber": "VIAF-000009475",
"archivingDate": {
"$date": "2019-11-15T00:00:00.000Z"
},
"actions": [
{
"user": "PA454196",
"type": "created",
"_id": {
"$oid": "5daa037cb66a2c601510e8a9"
},
"timestamp": {
"$date": "2019-10-18T18:25:00.426Z"
},
"normalized_comment": [],
"configs": []
},
{
"_id": {
"$oid": "5daa037cb66a2c601510e8a8"
},
"user": "PA454196",
"comment": "",
"type": "comment",
"timestamp": {
"$date": "2019-10-18T18:25:00.425Z"
},
"normalized_comment": [],
"configs": []
},
{
"_id": {
"$oid": "5daa037cb66a2c601510e8a7"
},
"user": "PA454196",
"type": "stored",
"timestamp": {
"$date": "2019-10-18T18:25:00.425Z"
},
"normalized_comment": [],
"configs": [
"container-1",
"station-toronto"
]
},
{
"_id": {
"$oid": "5daa03b9b66a2c601510e8ab"
},
"user": "PA454196",
"type": "comment",
"comment": "black nylon",
"timestamp": {
"$date": "2019-10-18T00:00:00.000Z"
},
"normalized_comment": [
"black",
"nylon"
],
"configs": []
},
{
"_id": {
"$oid": "5db1d7481fccee641499efd1"
},
"user": "GR452944",
"type": "comment",
"comment": "pax lives in Australia. currently awaiting for Address and authorization to send to Australia from Management ",
"timestamp": {
"$date": "2019-10-24T00:00:00.000Z"
},
"normalized_comment": [
"pax",
"lives",
"in",
"australia",
"currently",
"awaiting",
"for",
"address",
"and",
"authorization",
"to",
"send",
"to",
"australia",
"from",
"management"
],
"configs": []
},
{
"comment": "Bryan Lim\n12/3 Rockley Road\nSouth Yarra\nVictoria \nAUSTRALIA 3141\n",
"type": "comment",
"user": "GR452944",
"_id": {
"$oid": "5db9d0d53da9956709808899"
},
"timestamp": {
"$date": "2019-10-30T00:00:00.000Z"
},
"normalized_comment": [
"bryan",
"lim",
"123",
"rockley",
"road",
"south",
"yarra",
"victoria",
"australia",
"3141"
],
"configs": []
},
{
"comment": "OCT 30- Sent by Canada Post, tracking number LX035418234CA",
"type": "comment",
"user": "CH454138",
"_id": {
"$oid": "5db9d73d8e450c67172d0dea"
},
"timestamp": {
"$date": "2019-10-30T00:00:00.000Z"
},
"normalized_comment": [
"oct",
"30",
"sent",
"by",
"canada",
"post",
"tracking",
"number",
"lx035418234ca"
],
"configs": []
}
],
"otherAttributes": [],
"attributes": [],
"timestamp": {
"$date": "2019-10-18T18:25:00.423Z"
},
"foundDate": {
"$date": "2019-10-16T00:00:00.000Z"
},
"trainFoundAt": {
"number": "55",
"car": "3323",
"seat": ""
},
"status": "opened",
"pnrNumber": "VWZ975",
"matchIdNumber": "",
"__v": 4,
"imageData": {
"originalName": "20191018_142530[1].jpg_big.jpg",
"contentType": "images/jpeg",
"data": {
"$binary": "/9j/*****5qTxPbNfy2t/dMp3oEVd2Oe4FUb/w9O0dvd3xd4VTYis+Qgz0zWW/ZUTalof02pLM266i8pVR2G4gCuo9o9vJB4fuEjV1LhjGhPKrj3rql0Ks/9k=",
"$type": "00"
}
},
"imageThumbData": {
"originalName": "20191018_142530[1].jpg_thumb.jpg",
"contentType": "images/jpeg",
"data": {
"$binary": "/9j/***SP/2Q==",
"$type": "00"
}
},
"stationFoundAt": null
},
"schema": {
"type": "object",
"properties": {
"_id": {
"type": "object",
"properties": {
"$oid": {
"type": "string"
}
}
},
"normalized_otherCategory": {
"type": "string"
},
"category": {
"type": "string"
},
"otherCategory": {
"type": "string"
},
"location": {
"type": "string"
},
"referenceNumber": {
"type": "string"
},
"archivingDate": {
"type": "object",
"properties": {
"$date": {
"type": "string"
}
}
},
"actions": {
"type": "array",
"items": {
"type": "object",
"properties": {
"_id": {
"type": "object",
"properties": {
"$oid": {
"type": "string"
}
}
},
"type": {
"type": "string"
},
"user": {
"type": "string"
},
"timestamp": {
"type": "object",
"properties": {
"$date": {
"type": "string"
}
}
},
"normalized_comment": {
"type": "array"
},
"configs": {
"type": "array"
},
"comment": {
"type": "string"
}
},
"required": [
"_id",
"type",
"user",
"timestamp",
"normalized_comment",
"configs"
]
}
},
"otherAttributes": {
"type": "array"
},
"attributes": {
"type": "array"
},
"timestamp": {
"type": "object",
"properties": {
"$date": {
"type": "string"
}
}
},
"foundDate": {
"type": "object",
"properties": {
"$date": {
"type": "string"
}
}
},
"trainFoundAt": {
"type": "object",
"properties": {
"number": {
"type": "string"
},
"car": {
"type": "string"
},
"seat": {
"type": "string"
}
}
},
"status": {
"type": "string"
},
"matchIdNumber": {
"type": "string"
},
"__v": {
"type": "integer"
},
"imageData": {
"type": "object",
"properties": {
"originalName": {
"type": "string"
},
"contentType": {
"type": "string"
},
"data": {
"type": "object",
"properties": {
"$binary": {
"type": "string"
},
"$type": {
"type": "string"
}
}
}
}
},
"imageThumbData": {
"type": "object",
"properties": {
"originalName": {
"type": "string"
},
"contentType": {
"type": "string"
},
"data": {
"type": "object",
"properties": {
"$binary": {
"type": "string"
},
"$type": {
"type": "string"
}
}
}
}
},
"stationFoundAt": {
"type": "string"
}
},
"required": [
"_id",
"normalized_otherCategory",
"category",
"location",
"referenceNumber",
"archivingDate",
"actions",
"otherAttributes",
"attributes",
"timestamp",
"foundDate",
"status",
"matchIdNumber",
"__v"
]
}
}
here is a JSON which was parsed successfully:-
{
"content": {
"_id": {
"$oid": "5dde57bffeaf3f770907b144"
},
"normalized_otherCategory": "books,of,numbers",
"category": "books",
"otherCategory": "books of numbers",
"location": "ontrain",
"referenceNumber": "VIAF-000010334",
"archivingDate": {
"$date": "2020-02-24T00:00:00.000Z"
},
"actions": [
{
"_id": {
"$oid": "5dde57bffeaf3f770907b143"
},
"type": "created",
"user": "SO202505",
"timestamp": {
"$date": "2019-11-27T11:02:23.899Z"
},
"normalized_comment": [],
"configs": []
},
{
"type": "comment",
"comment": "",
"user": "SO202505",
"_id": {
"$oid": "5dde57bffeaf3f770907b142"
},
"timestamp": {
"$date": "2019-11-27T11:02:23.899Z"
},
"normalized_comment": [],
"configs": []
},
{
"type": "stored",
"user": "SO202505",
"_id": {
"$oid": "5dde57bffeaf3f770907b141"
},
"timestamp": {
"$date": "2019-11-27T11:02:23.899Z"
},
"normalized_comment": [],
"configs": [
"container-2",
"station-quebec"
]
}
],
"otherAttributes": [],
"attributes": [],
"timestamp": {
"$date": "2019-11-27T11:02:23.898Z"
},
"foundDate": {
"$date": "2019-11-26T00:00:00.000Z"
},
"trainFoundAt": {
"number": "28",
"car": "3",
"seat": "12c"
},
"status": "opened",
"pnrNumber": "",
"matchIdNumber": "",
"__v": 0,
"imageData": {
"originalName": "WIN_20191127_05_55_39_Pro.jpg_big.jpg",
"contentType": "images/jpeg",
"data": {
"$binary": "/9j/2****oI2SuUUUI/sRZ//9k=",
"$type": "00"
}
},
"imageThumbData": {
"originalName": "WIN_20191127_05_55_39_Pro.jpg_thumb.jpg",
"contentType": "images/jpeg",
"data": {
"$binary": "/9j/****Bn//2Q==",
"$type": "00"
}
}
},
"schema": {
"type": "object",
"properties": {
"_id": {
"type": "object",
"properties": {
"$oid": {
"type": "string"
}
}
},
"normalized_otherCategory": {
"type": "string"
},
"category": {
"type": "string"
},
"otherCategory": {
"type": "string"
},
"location": {
"type": "string"
},
"referenceNumber": {
"type": "string"
},
"archivingDate": {
"type": "object",
"properties": {
"$date": {
"type": "string"
}
}
},
"actions": {
"type": "array",
"items": {
"type": "object",
"properties": {
"_id": {
"type": "object",
"properties": {
"$oid": {
"type": "string"
}
}
},
"type": {
"type": "string"
},
"user": {
"type": "string"
},
"timestamp": {
"type": "object",
"properties": {
"$date": {
"type": "string"
}
}
},
"normalized_comment": {
"type": "array"
},
"configs": {
"type": "array"
},
"comment": {
"type": "string"
}
},
"required": [
"_id",
"type",
"user",
"timestamp",
"normalized_comment",
"configs"
]
}
},
"otherAttributes": {
"type": "array"
},
"attributes": {
"type": "array"
},
"timestamp": {
"type": "object",
"properties": {
"$date": {
"type": "string"
}
}
},
"foundDate": {
"type": "object",
"properties": {
"$date": {
"type": "string"
}
}
},
"trainFoundAt": {
"type": "object",
"properties": {
"number": {
"type": "string"
},
"car": {
"type": "string"
},
"seat": {
"type": "string"
}
}
},
"status": {
"type": "string"
},
"matchIdNumber": {
"type": "string"
},
"__v": {
"type": "integer"
},
"imageData": {
"type": "object",
"properties": {
"originalName": {
"type": "string"
},
"contentType": {
"type": "string"
},
"data": {
"type": "object",
"properties": {
"$binary": {
"type": "string"
},
"$type": {
"type": "string"
}
}
}
}
},
"imageThumbData": {
"type": "object",
"properties": {
"originalName": {
"type": "string"
},
"contentType": {
"type": "string"
},
"data": {
"type": "object",
"properties": {
"$binary": {
"type": "string"
},
"$type": {
"type": "string"
}
}
}
}
},
"stationFoundAt": {
"type": "string"
}
},
"required": [
"_id",
"normalized_otherCategory",
"category",
"location",
"referenceNumber",
"archivingDate",
"actions",
"otherAttributes",
"attributes",
"timestamp",
"foundDate",
"status",
"matchIdNumber",
"__v"
]
}
}
can anyone advice how i can fix this error for the 5% of the items?
Thanks
For string properties that can be null the type declaration should be defined as { "type": ["string", "null"] }.

Validating nested JSON attribute in schema

Here is my JSON schema and JSON as shown below at the bottom and using ajv validator to support json spec draft 7.
By default, the 'science' object must be represented as:
//Default science object
{"type": "science", "rule": {"sciencePattern": {}}}
where the 'rule' and 'sciencePattern' MUST be there.
However, if the 'sciencePattern' about to contains other attributes (as per the schema), then the below validation should kick in:
If the default science object is present, then the "scored" attributes in "arts" object should be REQUIRED.
If the NESTED "scored" array attribute is present within rule as:
{ "type": "science", "rule":{"sciencePattern":{"marks":{"scored":[10]}}} }
then the "scored" attributes in "arts" object should not be REQUIRED. In other words, if some one specify "scored" attribute withn the "arts" object, the schema validation should complain as there is a "scored" attribute is available in "science" object.
//JSON Schema
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"required": [
"exam"
],
"properties": {
"exam": {
"type": "array",
"minItems": 1,
"items": {
"anyOf": [
{
"$ref": "#/definitions/science"
},
{
"$ref": "#/definitions/arts"
}
]
}
},
"if": {
"type": "object",
"required": [
"type",
"rule"
],
"properties": {
"type": {
"const": "science"
},
"rule": {
"type": "object",
"required": [
"sciencePattern"
],
"properties": {
"sciencePattern": {
"$ref": "#/definitions/sciencePattern"
}
}
}
}
},
"then": {
"type": "object",
"required": [
"type"
],
"properties": {
"type": {
"const": "arts"
},
"not": {
"required": [
"scored"
]
}
}
}
},
"definitions": {
"sciencePattern": {
"type": "object",
"required": [
"marks"
],
"properties": {
"marks": {
"type": "object",
"required": [
"scored"
],
"properties": {
"scored": {
"type": "array"
}
}
}
}
},
"science": {
"type": "object",
"properties": {
"type": {
"const": "science"
},
"rule": {
"required": [
"sciencePattern"
],
"properties": {
"sciencePattern": {
"$ref": "#/definitions/sciencePattern"
}
}
}
}
},
"arts": {
"required": [
"scored"
],
"properties": {
"type": {
"const": "arts"
},
"scored": {
"type": "number"
},
"remarks": {
"type": "string"
}
}
}
}
}
and My JSON
{
"exam": [
{
"type": "science",
"rule": {
"sciencePattern": {
"marks": {
"scored": [10]
}
}
}
},
{
"type": "arts",
"scored": 10 //This should complain as 'scored' is available above in science
}
]
}
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"required": [
"exam"
],
"properties": {
"exam": {
"type": "array",
"allOf":[
{
"if": {
"contains": {
"type": "object",
"required": [
"type"
],
"properties": {
"type": {
"const": "science"
}
}
}
},
"then":{
"required":["rule", "sciencePattern"]
}
},
{
"if": {
"contains": {
"type": "object",
"required":["type","rule", "sciencePattern"],
"properties": {
"type": {
"const": "science"
}
}
}
},
"then":{
"required":["scored"]
}
},
{
"if": {
"contains": {
"type": "object",
"required": [
"type",
"rule"
],
"properties": {
"type": {
"const": "science"
},
"rule": {
"type": "object",
"required": [
"sciencePattern"
],
"properties": {
"sciencePattern": {
"$ref": "#/definitions/emptySciencePattern"
}
}
}
}
}
},
"then": {
"contains": {
"type": "object",
"required": ["type", "scored"],
"properties": {
"type": {
"const": "arts"
}
}
}
},
"else": {
"if": {
"contains": {
"type": "object",
"required": [
"type",
"rule"
],
"properties": {
"type": {
"const": "science"
},
"rule": {
"type": "object",
"required": [
"sciencePattern"
],
"properties": {
"sciencePattern": {
"$ref": "#/definitions/sciencePattern"
}
}
}
}
}
},
"then": {
"contains": {
"required": [
"type"
],
"properties": {
"type": {
"const": "arts"
}
},
"not": {
"required": ["scored"]
}
}
}
}
}],
"minItems": 1,
"items": {
"anyOf": [{
"$ref": "#/definitions/science"
}, {
"$ref": "#/definitions/arts"
}]
}
}
},
"definitions": {
"rule": {
"type": "object",
"required": ["sciencePattern"],
"properties": {
"sciencePattern": {
"$ref": "#/definitions/sciencePattern"
}
}
},
"emptySciencePattern": {
"type": "object",
"maxProperties": 0,
"additionalProperties": false,
"properties": {}
},
"sciencePattern": {
"type": "object",
"properties": {
"marks": {
"type": "object",
"properties": {
"scored": {
"type": "array"
}
}
}
}
},
"science": {
"type": "object",
"required": ["rule"],
"properties": {
"type": {
"const": "science"
},
"rule": {
"$ref":"#/definitions/rule"
}
}
},
"arts": {
"properties": {
"type": {
"const": "arts"
},
"scored": {
"type": "number"
},
"remarks": {
"type": "string"
}
}
}
}
}

JSON Schema not validating required attributes

Here is the criteria: the individual region object can co-exist withing the array along with ONLY asia/europe/austrlia (either one region at a time from asia/europe/austrlia).
In addition to this every region object can have few required attributes and nested one.
The issue is the schema validator is not complaining about the required attribute (i.e. width attribute from dimension object)
Here is the JSON Schema
{
"type": "object",
"$schema": "http://json-schema.org/draft-07/schema#",
"properties": {
"stat_data": {
"type": "array",
"if": {
"contains": {
"type": "object",
"properties": {
"region": {
"type": "string",
"enum": [
"europe"
]
}
}
}
},
"then": {
"not": {
"contains": {
"type": "object",
"properties": {
"region": {
"type": "string",
"enum": [
"asia",
"australia"
]
}
}
}
}
},
"else": {
"if": {
"contains": {
"type": "object",
"properties": {
"region": {
"type": "string",
"enum": [
"asia"
]
}
}
}
},
"then": {
"not": {
"contains": {
"type": "object",
"properties": {
"region": {
"type": "string",
"enum": [
"europe",
"australia"
]
}
}
}
}
},
"else": {
"if": {
"contains": {
"type": "object",
"properties": {
"region": {
"type": "string",
"enum": [
"australia"
]
}
}
}
},
"then": {
"not": {
"contains": {
"type": "object",
"properties": {
"region": {
"type": "string",
"enum": [
"europe",
"asia"
]
}
}
}
}
},
"else": {}
}
},
"items": {
"type": "object",
"properties": {
"details": {
"$ref": "#/definitions/dimension"
},
"population": {
"$ref": "#/definitions/details"
},
"dimension": {
"$ref": "#/definitions/population"
},
"region": {
"enum": [
"asia",
"europe",
"australia",
"some-pencil-region",
"some-oil-pastels-region"
]
}
}
}
}
},
"definitions": {
"dimension": {
"type": "object",
"required": [
"width"
],
"properties": {
"height": {
"type": "integer"
},
"width": {
"type": "integer"
}
}
},
"details": {
"type": "object",
"properties": {
"brand": {
"type": "string"
},
"year": {
"type": "integer"
}
}
},
"population": {
"type": "object",
"properties": {
"change": {
"type": "integer"
},
"year": {
"type": "integer"
}
}
}
}
}
and the JSON
{
"stat_data": [
{
"region": "some-pencil-region",
"details": {
"brand": "Camlin",
"year": 2019
}
},
{
"region": "some-oil-pastels-region",
"height": 30
},
{
"region": "asia",
"population": {
"year": 2018,
"change": 2
}
}
]
}
You can check at _https://jsonschema.dev/ by copying schema and json in the editor
Maybe your JSON validator doesn't catch the issue? JSONBuddy shows a message about a missing "width" property:

Host config bot framework [supportsInteractivity]

I am working on the webchat bot framework, more particularly on the hostconfig part of the adaptive card.
I want to use container selectaction but I do not have the expected display.
I created a basic card with container that I display on my chatbot but when I put the mouse cursor on the container, the card does not make the interactive effect yet the property supportsInteractivity is true.
Does anyone have any ideas?
Thans you
Here is my hostconfig:
{
"supportsInteractivity": true,
"spacing": {
"small": 4,
"default": 8,
"medium": 16,
"large": 24,
"extraLarge": 32,
"padding": 8
},
"separator": {
"lineThickness": 1,
"lineColor": "#cccccc"
},
"fontFamily": "\"Segoe UI\", sans-serif",
"fontSizes": {
"small": 12,
"default": 13,
"medium": 15,
"large": 17,
"extraLarge": 19
},
"fontWeights": {
"lighter": 200,
"default": 400,
"bolder": 700
},
"containerStyles": {
"default": {
"backgroundColor": "#00000000",
"foregroundColors": {
"default": {
"default": "#000000",
"subtle": "#808c95"
},
"accent": {
"default": "#2e89fc",
"subtle": "#802E8901"
},
"attention": {
"default": "#ffd800",
"subtle": "#CCFFD800"
},
"good": {
"default": "#00ff00",
"subtle": "#CC00FF00"
},
"warning": {
"default": "#ff0000",
"subtle": "#CCFF0000"
}
}
},
"emphasis": {
"backgroundColor": "#08000000",
"foregroundColors": {
"default": {
"default": "#333333",
"subtle": "#EE333333"
},
"accent": {
"default": "#2e89fc",
"subtle": "#882E89FC"
},
"attention": {
"default": "#cc3300",
"subtle": "#DDCC3300"
},
"good": {
"default": "#54a254",
"subtle": "#DD54A254"
},
"warning": {
"default": "#e69500",
"subtle": "#DDE69500"
}
}
}
},
"imageSizes": {
"small": 40,
"medium": 80,
"large": 160
},
"actions": {
"maxActions": 100,
"spacing": "default",
"buttonSpacing": 8,
"showCard": {
"actionMode": "inline",
"inlineTopMargin": 8
},
"actionsOrientation": "vertical",
"actionAlignment": "stretch"
},
"adaptiveCard": {
"allowCustomStyle": false
},
"imageSet": {
"imageSize": "medium",
"maxImageHeight": 100
},
"factSet": {
"title": {
"color": "default",
"size": "default",
"isSubtle": false,
"weight": "bolder",
"wrap": true,
"maxWidth": 150
},
"value": {
"color": "default",
"size": "default",
"isSubtle": false,
"weight": "default",
"wrap": true
},
"spacing": 8
}
}
and there is my card :
{
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.0",
"body": [
{
"type": "Container",
"items": [
{
"type": "TextBlock",
"text": "Text",
"weight": "bolder",
"size": "large",
"color": "accent",
"horizontalAlignment": "center"
}
]
},
{
"type": "Container",
"separator": true,
"items": [
{
"type": "TextBlock",
"text": "text",
"size": "medium",
"horizontalAlignment": "center",
"wrap": true
}
]
},
{
"type": "Container",
"separator": true,
"items": [
{
"type": "TextBlock",
"text": "text",
"horizontalAlignment": "center"
}
]
},
{
"type": "ColumnSet",
"columns": [
{
"type": "Column",
"style": "default",
"items": [
{
"type": "Container",
"style": "emphasis",
"items": [
{
"type": "TextBlock",
"text": "text"
}
],
"selectAction": {
"type": "Action.Submit",
"title": "text",
"data": {
"action": "1"
}
}
}
]
}
]
},
{
"type": "Container",
"separator": false,
"items": [
{
"type": "TextBlock",
"text": "text",
"horizontalAlignment": "center"
}
]
},
{
"type": "ColumnSet",
"columns": [
{
"type": "Column",
"style": "default",
"items": [
{
"type": "Container",
"style": "emphasis",
"items": [
{
"type": "TextBlock",
"text": "text"
}
],
"selectAction": {
"type": "Action.Submit",
"title": "text",
"data": {
"action": "1"
}
}
}
]
}
]
},
{
"type": "ColumnSet",
"columns": [
{
"type": "Column",
"style": "default",
"items": [
{
"type": "Container",
"style": "emphasis",
"items": [
{
"type": "TextBlock",
"text": "text"
}
],
"selectAction": {
"type": "Action.Submit",
"title": "text",
"data": {
"action": "1"
}
}
}
]
}
]
}
],
"actions": [
{
"type": "Action.Submit",
"title": "👍",
"data": {
"action": "2"
}
},
{
"type": "Action.ShowCard",
"title": "👎",
"card": {
"type": "AdaptiveCard",
"body": [
{
"type": "Input.Text",
"id": "comment",
"isMultiline": true,
"placeholder": "Add a comment"
}
],
"actions": [
{
"type": "Action.Submit",
"title": "Soumettre",
"data": {
"action": "3"
}
}
]
}
}
]
}

Unable to load json mapping Elasticsearch

I'm trying to map a json structure on Elasticsearch but something seems to be wrong because when I launch the curl command from my Windows prompt nothing appends except the underscore pulsing.
I use this curl command:
curl -H "Content-Type: application/json" -XPUT http://localhost:9200/technogym -d "{\"mappings\":{\"id\":{\"type\":\"string\"},\"key\":{\"type\":\"string\"},\"value\":{\"type\":\"object\",\"properties\":{\"rev\":{\"type\":\"string\"}}},\"doc\":{\"type\":\"object\",\"properties\":{\"_id\":{\"type\":\"string\"},\"_rev\":{\"type\":\"string\"},\"userID\":{\"type\":\"string\"},\"conversation_id\":{\"type\":\"string\"},\"input\":{\"type\":\"object\",\"properties\":{\"text\":{\"type\":\"string\"}}},\"output\":{\"type\":\"object\",\"properties\":{\"text\":{\"type\":\"string\"}}},\"node_visited\":{\"type\":\"string\"},\"intents\":{\"properties\":{\"intent\":{\"type\":\"string\"},\"confidence\":{\"type\":\"string\"}}},\"entities\":{\"type\":\"object\",\"properties\":{\"entity\":{\"type\":\"string\"},\"location\":{\"type\":\"string\"},\"value\":{\"type\":\"string\"},\"confidence\":{\"type\":\"string\"}}},\"timestamp\":{\"type\":\"date\"}}}}}"
Here my jsonwith mapping (just to make it more readable):
EDIT
{"mappings": {
"_default_": {
"properties": {
"id": {
"type": "string"
},
"key": {
"type": "string"
},
"value": {
"type": "object",
"properties": {
"rev": {
"type": "string"
}
}
},
"doc": {
"type": "object",
"properties": {
"_id": {
"type": "string"
},
"_rev": {
"type": "string"
},
"userID": {
"type": "string"
},
"conversation_id": {
"type": "string"
},
"input": {
"type": "object",
"properties": {
"text": {
"type": "string"
}
}
},
"output": {
"type": "object",
"properties": {
"text": {
"type": "string"
}
}
},
"node_visited": {
"type": "string"
},
"intents": {
"properties": {
"intent": {
"type": "string"
},
"confidence": {
"type": "string"
}
}
},
"entities": {
"type": "object",
"properties": {
"entity": {
"type": "string"
},
"location": {
"type": "string"
},
"value": {
"type": "string"
},
"confidence": {
"type": "string"
}
}
},
"timestamp": {
"type": "date"
}
}
}
}
}}}
I don't know why I can't upload this mapping.
Thanks for any help.
create an index
curl -XPUT localhost:9200/technogym
{"acknowledged":true}
Then apply your mapping to whatever type you want, eg. technogym_type
curl -X PUT localhost:9200/technogym/technogym_type/_mapping -d '{
"properties": {
"id": {
"type": "string"
},
"key": {
"type": "string"
},
"value": {
"type": "object",
"properties": {
"rev": {
"type": "string"
}
}
},
"doc": {
"type": "object",
"properties": {
"_id": {
"type": "string"
},
"_rev": {
"type": "string"
},
"userID": {
"type": "string"
},
"conversation_id": {
"type": "string"
},
"input": {
"type": "object",
"properties": {
"text": {
"type": "string"
}
}
},
"output": {
"type": "object",
"properties": {
"text": {
"type": "string"
}
}
},
"node_visited": {
"type": "string"
},
"intents": {
"properties": {
"intent": {
"type": "string"
},
"confidence": {
"type": "string"
}
}
},
"entities": {
"type": "object",
"properties": {
"entity": {
"type": "string"
},
"location": {
"type": "string"
},
"value": {
"type": "string"
},
"confidence": {
"type": "string"
}
}
},
"timestamp": {
"type": "date"
}
}
}
}
}'
{"acknowledged":true}
But if you dynamically want to create index and mappings, just fix your JSON document where it needs mappings (plural) and followed by the name of the type you want. (type equivalent to RDBMS table name)
curl -X PUT localhost:9200/technogym1 -d '
{
"mappings": {
"technogym_type1": {
"properties": {
"id": {
"type": "string"
},
"key": {
"type": "string"
},
"value": {
"type": "object",
"properties": {
"rev": {
"type": "string"
}
}
},
"doc": {
"type": "object",
"properties": {
"_id": {
"type": "string"
},
"_rev": {
"type": "string"
},
"userID": {
"type": "string"
},
"conversation_id": {
"type": "string"
},
"input": {
"type": "object",
"properties": {
"text": {
"type": "string"
}
}
},
"output": {
"type": "object",
"properties": {
"text": {
"type": "string"
}
}
},
"node_visited": {
"type": "string"
},
"intents": {
"properties": {
"intent": {
"type": "string"
},
"confidence": {
"type": "string"
}
}
},
"entities": {
"type": "object",
"properties": {
"entity": {
"type": "string"
},
"location": {
"type": "string"
},
"value": {
"type": "string"
},
"confidence": {
"type": "string"
}
}
},
"timestamp": {
"type": "date"
}
}
}
}
}
}
}'
{"acknowledged":true,"shards_acknowledged":true}
You need to change mapping to mappings.
{
"mappings": { ==> change this
"_default_": {
"properties": {
"id": {
"type": "string"
},
"key": {
"type": "string"
},
"value": {
"type": "object",
"properties": {
"rev": {
"type": "string"
}
}
},
"doc": {
"type": "object",
"properties": {
"_id": {
"type": "string"
},
"_rev": {
"type": "string"
},
"userID": {
"type": "string"
},
"conversation_id": {
"type": "string"
},
"input": {
"type": "object",
"properties": {
"text": {
"type": "string"
}
}
},
"output": {
"type": "object",
"properties": {
"text": {
"type": "string"
}
}
},
"node_visited": {
"type": "string"
},
"intents": {
"properties": {
"intent": {
"type": "string"
},
"confidence": {
"type": "string"
}
}
},
"entities": {
"type": "object",
"properties": {
"entity": {
"type": "string"
},
"location": {
"type": "string"
},
"value": {
"type": "string"
},
"confidence": {
"type": "string"
}
}
},
"timestamp": {
"type": "date"
}
}}}}}}