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"] }.
There is an example of a switch-like condition in the JSON Schema documentation.
https://json-schema.org/understanding-json-schema/reference/conditionals.html
I have added two more countries to the example, which both should have the same postal code patterns as Netherlands. I can get this example to work with two additional if/then structures, but it becomes messy when more items are to be added.
Is there DRYer version, e.g. like the hypothetical one below?
"properties": { "country": { "const": ["Netherlands", "Upperlands", "Lowerlands" } }
{
"type": "object",
"properties": {
"street_address": {
"type": "string"
},
"country": {
"enum": ["United States of America", "Canada", "Netherlands",
"Upperlands","Lowerlands"]
}
},
"allOf": [
{
"if": {
"properties": { "country": { "const": "United States of America" } }
},
"then": {
"properties": { "postal_code": { "pattern": "[0-9]{5}(-[0-9]{4})?" } }
}
},
{
"if": {
"properties": { "country": { "const": "Canada" } }
},
"then": {
"properties": { "postal_code": { "pattern": "[A-Z][0-9][A-Z] [0-9][A-Z][0-9]" } }
}
},
{
"if": {
"properties": { "country": { "const": "Netherlands" } }
},
"then": {
"properties": { "postal_code": { "pattern": "[0-9]{4} [A-Z]{2}" } }
}
}
]
}
You could use the enum pattern instead. It's less verbose and easier to read, but the error messages you get are terrible, so I suggest you stick with the if/then pattern. Here's what using the enum pattern would look like.
{
"type": "object",
"properties": {
"street_address": {
"type": "string"
},
"country": {
"enum": ["United States of America", "Canada", "Netherlands",
"Upperlands","Lowerlands"]
}
},
"anyOf": [
{
"properties": {
"country": { "const": "United States of America" },
"postal_code": { "pattern": "[0-9]{5}(-[0-9]{4})?" }
}
},
{
"properties": {
"country": { "const": "Canada" },
"postal_code": { "pattern": "[A-Z][0-9][A-Z] [0-9][A-Z][0-9]" }
}
},
{
"properties": {
"country": { "const": "Netherlands" },
"postal_code": { "pattern": "[0-9]{4} [A-Z]{2}" }
}
}
]
}
Although there isn't good way around the verbosity, there is something you can do to improve readability/maintainability. You can use definitions to hide the verbose parts.
{
"type": "object",
"properties": {
"street_address": {
"type": "string"
},
"country": {
"enum": ["United States of America", "Canada", "Netherlands",
"Upperlands","Lowerlands"]
}
},
"allOf": [
{ "$ref": "#/definitions/validate-us-postal-code" },
{ "$ref": "#/definitions/validate-ca-postal-code" },
{ "$ref": "#/definitions/validate-nl-postal-code" }
]
"definitions": {
"validate-us-postal-code": {
"if": {
"properties": { "country": { "const": "United States of America" } }
},
"then": {
"properties": { "postal_code": { "pattern": "[0-9]{5}(-[0-9]{4})?" } }
}
},
"validate-ca-postal-code": {
"if": {
"properties": { "country": { "const": "Canada" } }
},
"then": {
"properties": { "postal_code": { "pattern": "[A-Z][0-9][A-Z] [0-9][A-Z][0-9]" } }
}
},
"validate-nl-postal-code": {
"if": {
"properties": { "country": { "const": "Netherlands" } }
},
"then": {
"properties": { "postal_code": { "pattern": "[0-9]{4} [A-Z]{2}" } }
}
}
}
}
This allows someone to be able to understand everything this schema does just by reading the first few lines. The verbose/complicated stuff is pushed to the bottom where you don't have to deal with it if you don't need to.
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"
}
}
]
}
}
]
}
I have several products with variations like the one below
{
"title": "100% Cotton Unstitched Suit For Men",
"slug": "100-cotton-unstitched-suit-for-men",
"price": 200,
"sale_price": 0,
"vendor_id": 32,
"featured": 0,
"viewed": 20,
"stock": 4,
"sku": "XXX-B",
"rating": 0,
"active": 1,
"vendor_name": "vendor_name",
"category": [
"men_fashion",
"traditional_clothing",
"unstitched_fabric"
],
"image": "imagename.jpg",
"variations": [
{
"variation_id": "34",
"stock": 5,
"price": 200,
"variation_image": "",
"sku": "XXX-C",
"size": "m",
"color": "red"
},
{
"variation_id": "35",
"stock": 5,
"price": 200,
"variation_image": "",
"sku": "XXX-D",
"size": "l",
"color": "red"
}
]
}
I am looking for a query that would have all of the below parameters
Get all products in a certain category
Get all products that are black
Get sizes l and m
My current Query:
{
"size": 15,
"from": 0,
"query": {
"filtered": {
"filter": {
"bool": {
"must": [
{
"match": {
"category": "women_fashion"
}
},
{
"nested": {
"path": "variations",
"query": {
"bool": {
"must": [{
"match": {
"variations.color": "red"
}
},
{
"match": {
"variations.size": "l"
}
},
{
"match": {
"variations.size": "m"
}
}
]
}
}
}
}
]
}
}
}
}
}
It works fine if i only search for 1 size. But once i search for 2 sizes it gives no records. My guess is that it looks for all 3 parameters in every nested variation, which obviously it cant find. How would i modify the query to search for
size: m, color: black
size: l, color: black
I have also tried using a nested filter, but the issue with this is that it works like "SHOULD" query while i am looking for a "MUST" query. ie. it shows all the products have large variations while i just want to show products that are large and red.
My Second Query:
{
"size": 15,
"from": 0,
"query": {
"filtered": {
"filter": {
"bool": {
"must": [
{
"match": {
"category": "women_fashion"
}
},
{
"nested": {
"path": "variations",
"query": {
"bool":{
"filter": [
{
"term": {
"variations.color": "red"
}
},
{
"term": {
"variations.size": "l"
}
}
]
}
}
}
}
]
}
}
}
}
}
You can put the size variations into a clause of it's own so at least one of the sizes will match
{
"query": {
"filtered": {
"filter": {
"bool": {
"must": [
{
"match": {
"category": "women_fashion"
}
},
{
"nested": {
"path": "variations",
"query": {
"bool": {
"must": [
{
"match": {
"variations.color": "red"
}
},
{
"query": {
"bool": {
"should": [
{
"match": {
"variations.size": "l"
}
},
{
"match": {
"variations.size": "m"
}
}
]
}
}
}
]
}
}
}
}
]
}
}
}
}
}