I have a JSON formatted output as below, how to access and valid the outputs of each node with Assert statement - browser

I have a JSON formatted output as below, how to access and valid the outputs of each node with Assert statement
{
"Type": "Page",
"X": 0,
"Y": 0,
"Width": 696,
"Height": 888,
"Children": [
{
"Type": "Column",
"X": 0,
"Y": 0,
"Width": 696,
"Height": 888,
"Children": [
{
"Type": "Paragraph",
"X": 209,
"Y": 290,
"Width": 248,
"Height": 24,
"Children": [
{
"Type": "Line",
"X": 209,
"Y": 290,
"Width": 248,
"Height": 24,
"Children": [
{
"Type": "Word",
"X": 209,
"Y": 290,
"Width": 49,
"Height": 24,
"Children": [
],
"Content": "Core"
},
{
"Type": "Word",
"X": 263,
"Y": 290,
"Width": 106,
"Height": 24,
"Children": [
],
"Content": "Enterprise"
},
{
"Type": "Word",
"X": 375,
"Y": 290,
"Width": 82,
"Height": 24,
"Children": [
],
"Content": "Installer"
}
],
"Content": null
}
],
"Content": null
},
{
"Type": "Paragraph",
"X": 580,
"Y": 803,
"Width": 79,
"Height": 13,
"Children": [
{
"Type": "Line",
"X": 580,
"Y": 803,
"Width": 79,
"Height": 13,
"Children": [
{
"Type": "Word",
"X": 580,
"Y": 803,
"Width": 46,
"Height": 13,
"Children": [
],
"Content": "Version"
},
{
"Type": "Word",
"X": 629,
"Y": 803,
"Width": 12,
"Height": 13,
"Children": [
],
"Content": "8."
},
{
"Type": "Word",
"X": 640,
"Y": 803,
"Width": 12,
"Height": 13,
"Children": [
],
"Content": "0."
},
{
"Type": "Word",
"X": 651,
"Y": 803,
"Width": 8,
"Height": 13,
"Children": [
],
"Content": "0"
}
],
"Content": null
}
],
"Content": null
}
],
"Content": null
}
],
"Content": null
}
Looking for solutions

Related

How to create an order in Shopware6 via API?

I am trying to create an order in Shopware6 via the Admin API
My Json Object:
// POST https://myserver.example.com/api/v3/order
{
"currencyId": "b7d2554b0ce847cd82f3ac9bd1c0dfca",
"salesChannelId": "ed47859020cc46349ed5f024c65d09e5",
"billingAddressId": "629002cceec64dd888b4c52b782d6427",
"stateId": "9c22101c81d14eb9be55a93a3ba39aa2",
"languageId": "2fbb5fe2e29a4d70aa5854ce7ce3e20b",
"currencyFactor": 1,
"orderCustomer": {
"email": "abc#xyz.com",
"salutationId": "1354f03b5d7c414e8b5aaddd0a32e8ca",
"firstName": "Donald",
"lastName": "Duck",
"customerNumber": "10045",
"customerId": "9432a62c65ae4bcbb335c3bc853d79e8",
"remoteAddress": "10.147.19.0"
},
"price": {
"netPrice": 33.57,
"totalPrice": 39.95,
"calculatedTaxes": [{
"tax": 6.38,
"taxRate": 19,
"price": 39.95
}],
"taxRules": [{
"taxRate": 19,
"percentage": 100
}],
"positionPrice": 39.95,
"taxStatus": "gross"
},
"orderDateTime": "2021-04-21T14:27:57.006+0000",
"createdAt": "2021-04-21T14:27:57.056+0000",
"lineItems": [{
"identifier": "8c380f63883449adec1ee4ccb456c489",
"quantity": 1,
"label": "Handtasche - Designer Bag",
"type": "product",
"good": true,
"removable": true,
"stackable": true,
"position": 1,
"price": {
"unitPrice": 39.95,
"quantity": 1,
"totalPrice": 39.95,
"calculatedTaxes": [{
"tax": 6.38,
"taxRate": 19,
"price": 39.95
}],
"taxRules": [{
"taxRate": 19,
"percentage": 100
}]
},
"createdAt": "2021-04-21T14:27:57.054+0000"
}]
}
But this gives me the Response:
{
"errors": [{
"code": "0",
"status": "500",
"title": "Internal Server Error",
"detail": "Notice: Trying to access array offset on value of type null",
"meta": {
"trace": [{
"file": "\/data\/srv\/myserver.example.com\/www\/releases\/0.0\/vendor\/shopware\/core\/Framework\/DataAbstractionLayer\/Dbal\/EntityHydrator.php",
"line": 213,
"function": "decode",
"class": "Shopware\\Core\\Framework\\DataAbstractionLayer\\FieldSerializer\\CalculatedPriceFieldSerializer",
"type": "-\u003E"
},
{
"file": "\/data\/srv\/myserver.example.com\/www\/releases\/0.0\/vendor\/shopware\/core\/Framework\/DataAbstractionLayer\/Dbal\/EntityHydrator.php",
"line": 49,
"function": "hydrateEntity",
"class": "Shopware\\Core\\Framework\\DataAbstractionLayer\\Dbal\\EntityHydrator",
"type": "-\u003E"
},
{
"file": "\/data\/srv\/myserver.example.com\/www\/releases\/0.0\/vendor\/shopware\/core\/Framework\/DataAbstractionLayer\/Dbal\/EntityReader.php",
"line": 126,
"function": "hydrate",
"class": "Shopware\\Core\\Framework\\DataAbstractionLayer\\Dbal\\EntityHydrator",
"type": "-\u003E"
},
{
"file": "\/data\/srv\/myserver.example.com\/www\/releases\/0.0\/vendor\/shopware\/core\/Framework\/DataAbstractionLayer\/Dbal\/EntityReader.php",
"line": 94,
"function": "_read",
"class": "Shopware\\Core\\Framework\\DataAbstractionLayer\\Dbal\\EntityReader",
"type": "-\u003E"
},
{
"file": "\/data\/srv\/myserver.example.com\/www\/releases\/0.0\/vendor\/shopware\/core\/Framework\/DataAbstractionLayer\/Cache\/CachedEntityReader.php",
"line": 130,
"function": "read",
"class": "Shopware\\Core\\Framework\\DataAbstractionLayer\\Dbal\\EntityReader",
"type": "-\u003E"
},
{
"file": "\/data\/srv\/myserver.example.com\/www\/releases\/0.0\/vendor\/shopware\/core\/Framework\/DataAbstractionLayer\/Cache\/CachedEntityReader.php",
"line": 55,
"function": "loadResultByIds",
"class": "Shopware\\Core\\Framework\\DataAbstractionLayer\\Cache\\CachedEntityReader",
"type": "-\u003E"
},
{
"file": "\/data\/srv\/myserver.example.com\/www\/releases\/0.0\/vendor\/shopware\/core\/Profiling\/Entity\/EntityReaderProfiler.php",
"line": 36,
"function": "read",
"class": "Shopware\\Core\\Framework\\DataAbstractionLayer\\Cache\\CachedEntityReader",
"type": "-\u003E"
},
{
"file": "\/data\/srv\/myserver.example.com\/www\/releases\/0.0\/vendor\/shopware\/core\/Framework\/DataAbstractionLayer\/EntityRepository.php",
"line": 239,
"function": "read",
"class": "Shopware\\Core\\Profiling\\Entity\\EntityReaderProfiler",
"type": "-\u003E"
},
{
"file": "\/data\/srv\/myserver.example.com\/www\/releases\/0.0\/vendor\/shopware\/core\/Framework\/DataAbstractionLayer\/EntityRepository.php",
"line": 91,
"function": "read",
"class": "Shopware\\Core\\Framework\\DataAbstractionLayer\\EntityRepository",
"type": "-\u003E"
},
{
"file": "\/data\/srv\/myserver.example.com\/www\/releases\/0.0\/vendor\/shopware\/core\/Checkout\/Customer\/Subscriber\/CustomerMetaFieldSubscriber.php",
"line": 62,
"function": "search",
"class": "Shopware\\Core\\Framework\\DataAbstractionLayer\\EntityRepository",
"type": "-\u003E"
},
{
"file": "\/data\/srv\/myserver.example.com\/www\/releases\/0.0\/vendor\/symfony\/event-dispatcher\/EventDispatcher.php",
"line": 304,
"function": "fillCustomerMetaDataFields",
"class": "Shopware\\Core\\Checkout\\Customer\\Subscriber\\CustomerMetaFieldSubscriber",
"type": "-\u003E"
},
{
"file": "\/data\/srv\/myserver.example.com\/www\/releases\/0.0\/vendor\/symfony\/event-dispatcher\/EventDispatcher.php",
"line": 251,
"function": "Symfony\\Component\\EventDispatcher\\{closure}",
"class": "Symfony\\Component\\EventDispatcher\\EventDispatcher",
"type": "::"
},
{
"file": "\/data\/srv\/myserver.example.com\/www\/releases\/0.0\/vendor\/symfony\/event-dispatcher\/EventDispatcher.php",
"line": 73,
"function": "callListeners",
"class": "Symfony\\Component\\EventDispatcher\\EventDispatcher",
"type": "-\u003E"
},
{
"file": "\/data\/srv\/myserver.example.com\/www\/releases\/0.0\/vendor\/shopware\/core\/Framework\/Webhook\/WebhookDispatcher.php",
"line": 88,
"function": "dispatch",
"class": "Symfony\\Component\\EventDispatcher\\EventDispatcher",
"type": "-\u003E"
},
{
"file": "\/data\/srv\/myserver.example.com\/www\/releases\/0.0\/vendor\/shopware\/core\/Framework\/Event\/BusinessEventDispatcher.php",
"line": 46,
"function": "dispatch",
"class": "Shopware\\Core\\Framework\\Webhook\\WebhookDispatcher",
"type": "-\u003E"
},
{
"file": "\/data\/srv\/myserver.example.com\/www\/releases\/0.0\/vendor\/shopware\/core\/Framework\/Event\/NestedEventDispatcher.php",
"line": 32,
"function": "dispatch",
"class": "Shopware\\Core\\Framework\\Event\\BusinessEventDispatcher",
"type": "-\u003E"
},
{
"file": "\/data\/srv\/myserver.example.com\/www\/releases\/0.0\/vendor\/shopware\/core\/Framework\/Event\/NestedEventDispatcher.php",
"line": 28,
"function": "dispatch",
"class": "Shopware\\Core\\Framework\\Event\\NestedEventDispatcher",
"type": "-\u003E"
},
{
"file": "\/data\/srv\/myserver.example.com\/www\/releases\/0.0\/vendor\/symfony\/event-dispatcher\/Debug\/TraceableEventDispatcher.php",
"line": 168,
"function": "dispatch",
"class": "Shopware\\Core\\Framework\\Event\\NestedEventDispatcher",
"type": "-\u003E"
},
{
"file": "\/data\/srv\/myserver.example.com\/www\/releases\/0.0\/vendor\/shopware\/core\/Framework\/DataAbstractionLayer\/EntityRepository.php",
"line": 178,
"function": "dispatch",
"class": "Symfony\\Component\\EventDispatcher\\Debug\\TraceableEventDispatcher",
"type": "-\u003E"
},
{
"file": "\/data\/srv\/myserver.example.com\/www\/releases\/0.0\/vendor\/shopware\/core\/Framework\/Api\/Controller\/ApiController.php",
"line": 916,
"function": "create",
"class": "Shopware\\Core\\Framework\\DataAbstractionLayer\\EntityRepository",
"type": "-\u003E"
},
{
"file": "\/data\/srv\/myserver.example.com\/www\/releases\/0.0\/vendor\/shopware\/core\/Framework\/Context.php",
"line": 183,
"function": "Shopware\\Core\\Framework\\Api\\Controller\\{closure}",
"class": "Shopware\\Core\\Framework\\Api\\Controller\\ApiController",
"type": "-\u003E"
},
{
"file": "\/data\/srv\/myserver.example.com\/www\/releases\/0.0\/vendor\/shopware\/core\/Framework\/Api\/Controller\/ApiController.php",
"line": 934,
"function": "scope",
"class": "Shopware\\Core\\Framework\\Context",
"type": "-\u003E"
},
{
"file": "\/data\/srv\/myserver.example.com\/www\/releases\/0.0\/vendor\/shopware\/core\/Framework\/Api\/Controller\/ApiController.php",
"line": 780,
"function": "executeWriteOperation",
"class": "Shopware\\Core\\Framework\\Api\\Controller\\ApiController",
"type": "-\u003E"
},
{
"file": "\/data\/srv\/myserver.example.com\/www\/releases\/0.0\/vendor\/shopware\/core\/Framework\/Api\/Controller\/ApiController.php",
"line": 452,
"function": "write",
"class": "Shopware\\Core\\Framework\\Api\\Controller\\ApiController",
"type": "-\u003E"
},
{
"file": "\/data\/srv\/myserver.example.com\/www\/releases\/0.0\/vendor\/symfony\/http-kernel\/HttpKernel.php",
"line": 158,
"function": "create",
"class": "Shopware\\Core\\Framework\\Api\\Controller\\ApiController",
"type": "-\u003E"
},
{
"file": "\/data\/srv\/myserver.example.com\/www\/releases\/0.0\/vendor\/symfony\/http-kernel\/HttpKernel.php",
"line": 80,
"function": "handleRaw",
"class": "Symfony\\Component\\HttpKernel\\HttpKernel",
"type": "-\u003E"
},
{
"file": "\/data\/srv\/myserver.example.com\/www\/releases\/0.0\/vendor\/symfony\/http-kernel\/Kernel.php",
"line": 201,
"function": "handle",
"class": "Symfony\\Component\\HttpKernel\\HttpKernel",
"type": "-\u003E"
},
{
"file": "\/data\/srv\/myserver.example.com\/www\/releases\/0.0\/vendor\/symfony\/http-kernel\/HttpCache\/SubRequestHandler.php",
"line": 85,
"function": "handle",
"class": "Symfony\\Component\\HttpKernel\\Kernel",
"type": "-\u003E"
},
{
"file": "\/data\/srv\/myserver.example.com\/www\/releases\/0.0\/vendor\/symfony\/http-kernel\/HttpCache\/HttpCache.php",
"line": 477,
"function": "handle",
"class": "Symfony\\Component\\HttpKernel\\HttpCache\\SubRequestHandler",
"type": "::"
},
{
"file": "\/data\/srv\/myserver.example.com\/www\/releases\/0.0\/vendor\/symfony\/http-kernel\/HttpCache\/HttpCache.php",
"line": 267,
"function": "forward",
"class": "Symfony\\Component\\HttpKernel\\HttpCache\\HttpCache",
"type": "-\u003E"
},
{
"file": "\/data\/srv\/myserver.example.com\/www\/releases\/0.0\/vendor\/symfony\/http-kernel\/HttpCache\/HttpCache.php",
"line": 283,
"function": "pass",
"class": "Symfony\\Component\\HttpKernel\\HttpCache\\HttpCache",
"type": "-\u003E"
},
{
"file": "\/data\/srv\/myserver.example.com\/www\/releases\/0.0\/vendor\/symfony\/http-kernel\/HttpCache\/HttpCache.php",
"line": 211,
"function": "invalidate",
"class": "Symfony\\Component\\HttpKernel\\HttpCache\\HttpCache",
"type": "-\u003E"
},
{
"file": "\/data\/srv\/myserver.example.com\/www\/releases\/0.0\/vendor\/shopware\/core\/HttpKernel.php",
"line": 163,
"function": "handle",
"class": "Symfony\\Component\\HttpKernel\\HttpCache\\HttpCache",
"type": "-\u003E"
},
{
"file": "\/data\/srv\/myserver.example.com\/www\/releases\/0.0\/vendor\/shopware\/core\/HttpKernel.php",
"line": 80,
"function": "doHandle",
"class": "Shopware\\Core\\HttpKernel",
"type": "-\u003E"
},
{
"file": "\/data\/srv\/myserver.example.com\/www\/releases\/0.0\/public\/index.php",
"line": 83,
"function": "handle",
"class": "Shopware\\Core\\HttpKernel",
"type": "-\u003E"
}],
"file": "\/data\/srv\/myserver.example.com\/www\/releases\/0.0\/vendor\/shopware\/core\/Framework\/DataAbstractionLayer\/FieldSerializer\/CalculatedPriceFieldSerializer.php",
"line": 51
}
}]
I tried all kinds of different variations with the "price" object, with calculated taxes, without and anything that came to my mind, no success.
How would a correct JSON object look like that successfully creates an order?
When I work with the API, sometimes I just create an entity manually (e.g. Order) & then try to GET it via the API. Then you can just copy the formatting and feed it back to your POST call.
You might be missing "rawTotal": 468.55 in your main price object.
That said, the error suggests that the value should be an array, but it is not set. They don't use version numbers in their API anymore, so maybe this is no longer relevant :)

timeUnit does not work after a flatten and flod transformation

Is it possible to use timeUnit after a flatten and flod transformation?
In the example below it doesnt work!
If I remove the timeUnit from the x axis it plots, but without the good things that come with the timeUnit.
Thanks
This is an example code that can be executed in the link below
https://vega.github.io/editor/#/edited
{
"$schema": "https://vega.github.io/schema/vega-lite/v4.json",
"description": "Sales in a Year.",
"width": 500,
"height": 200,
"data": {
"values": [
{"timestamp": ["2019-01-01","2019-02-01","2019-03-01","2019-04-01","2019-05-01","2019-06-01",
"2019-07-01","2019-08-01","2019-09-01","2019-10-01","2019-11-01","2019-12-01"],
"cars" : [55, 43, 91, 81, 53, 19, 87, 52, 52, 44, 52, 52],
"bikes" : [12, 6, 2, 0, 0, 0, 0, 0, 0, 3, 9, 15]}
]
},
"transform": [
{"flatten": ["timestamp", "cars", "bikes"]},
{"fold": ["cars", "bikes"]}
],
"mark": {"type":"bar", "tooltip": true, "cornerRadiusEnd": 4},
"encoding": {
"x": {"field": "timestamp",
"timeUnit": "month",
"type": "ordinal",
"title": "",
"axis": {"labelAngle": 0}},
"y": {"field": "value",
"type": "quantitative",
"title": "Soiling Loss"},
"color":{"field": "key",
"type": "nominal"}
}
}
For convenience, strings in input data with a simple temporal encoding are automatically parsed as dates, but such parsing is not applied to data that is the result of a transformation.
In this case, you can do the parsing manually with a calculate transform (view in editor):
{
"$schema": "https://vega.github.io/schema/vega-lite/v4.json",
"description": "Sales in a Year.",
"width": 500,
"height": 200,
"data": {
"values": [
{
"timestamp": [
"2019-01-01",
"2019-02-01",
"2019-03-01",
"2019-04-01",
"2019-05-01",
"2019-06-01",
"2019-07-01",
"2019-08-01",
"2019-09-01",
"2019-10-01",
"2019-11-01",
"2019-12-01"
],
"cars": [55, 43, 91, 81, 53, 19, 87, 52, 52, 44, 52, 52],
"bikes": [12, 6, 2, 0, 0, 0, 0, 0, 0, 3, 9, 15]
}
]
},
"transform": [
{"flatten": ["timestamp", "cars", "bikes"]},
{"fold": ["cars", "bikes"]},
{"calculate": "toDate(datum.timestamp)", "as": "timestamp"}
],
"mark": {"type": "bar", "tooltip": true, "cornerRadiusEnd": 4},
"encoding": {
"x": {
"field": "timestamp",
"timeUnit": "month",
"type": "ordinal",
"title": "",
"axis": {"labelAngle": 0}
},
"y": {"field": "value", "type": "quantitative", "title": "Soiling Loss"},
"color": {"field": "key", "type": "nominal"}
}
}

node-red Mqtt, how to close socket connection

red-contrib-mqtt-broker` as mqtt broker. connection/disconnection of clients, are happening fine but in backend sockets are not getting closed immediately so sockets getting pileup.and its leading to server down.
please help me how to resolve this issue.
here is my node-red flow
[
{
"checkall": "false",
"id": "75e2813d.1200d",
"name": "chkTopic",
"outputs": 3,
"property": "topic",
"propertyType": "msg",
"repair": false,
"rules": [
{
"t": "eq",
"v": "clientConnected",
"vt": "str"
},
{
"t": "eq",
"v": "published",
"vt": "str"
},
{
"t": "eq",
"v": "clientDisconnected",
"vt": "str"
}
],
"type": "switch",
"wires": [
[
"e44d3fd.601fcc"
],
[
"b0cbe2f0.fdf51"
],
[
"352b1527.c0382a"
]
],
"x": 340,
"y": 120,
"z": "9207591e.000228"
},
{
"dburl": "",
"id": "169a1574.037e8b",
"mqtt_port": "6883",
"mqtt_ws_port": "6889",
"name": "Silsung ST Connector",
"password": "ajay1234",
"type": "mosca in",
"username": "admin",
"wires": [
[
"75e2813d.1200d"
]
],
"x": 140,
"y": 120,
"z": "9207591e.000228"
},
{
"active": true,
"complete": "payload",
"console": false,
"id": "b0cbe2f0.fdf51",
"name": "",
"tosidebar": true,
"tostatus": false,
"type": "debug",
"wires": [],
"x": 530,
"y": 120,
"z": "9207591e.000228"
},
{
"active": true,
"complete": "payload",
"console": false,
"id": "352b1527.c0382a",
"name": "",
"tosidebar": true,
"tostatus": false,
"type": "debug",
"wires": [],
"x": 530,
"y": 180,
"z": "9207591e.000228"
},
{
"active": true,
"complete": "payload",
"console": false,
"id": "e44d3fd.601fcc",
"name": "",
"tosidebar": true,
"tostatus": false,
"type": "debug",
"wires": [],
"x": 510,
"y": 60,
"z": "9207591e.000228"
}
]

Azure OCR [printed text] is not reading the receipt lines in the right order

Application Goal: read the receipt image, extract the store/organization name along with the total amount paid. Feed it to web-form for auto-filling & submission.
Post Request - "https://*.cognitiveservices.azure.com/vision/v2.0/recognizeText?{params}
Get Request - https://*.cognitiveservices.azure.com/vision/v2.0/textOperations/{operationId}
however when I get the results back, sometimes it's confusing in line ordering (see below picture [similar results in JSON response])
This mixing is resulting in getting the total as $0.88
Similar situations are present for 2 out of 9 testing receipts.
Q: Why it's working for similar & different structured receipts but for some reason not consistent for all? Also, any ideas how to get around it?
I had a quick look to your case.
OCR Result
As you mentioned, the results are not ordered as you thought. I had a quick look to the bounding boxes values and I don't know how they are ordered. You could try to consolidate fields based on that, but there is a service that is already doing it for you.
Form Recognizer:
Using Form Recognizer and your image, I got the following results for your receipt.
As you can see below, the understandingResults contains the total with its value ("value": 9.11), the MerchantName ("Chick-fil-a") and other fields.
{
"status": "Succeeded",
"recognitionResults": [
{
"page": 1,
"clockwiseOrientation": 0.17,
"width": 404,
"height": 1226,
"unit": "pixel",
"lines": [
{
"boundingBox": [
108,
55,
297,
56,
296,
71,
107,
70
],
"text": "Welcome to Chick-fil-a",
"words": [
{
"boundingBox": [
108,
56,
169,
56,
169,
71,
108,
71
],
"text": "Welcome",
"confidence": "Low"
},
{
"boundingBox": [
177,
56,
194,
56,
194,
71,
177,
71
],
"text": "to"
},
{
"boundingBox": [
201,
56,
296,
57,
296,
71,
201,
71
],
"text": "Chick-fil-a"
}
]
},
...
OTHER LINES CUT FOR DISPLAY
...
]
}
],
"understandingResults": [
{
"pages": [
1
],
"fields": {
"Subtotal": null,
"Total": {
"valueType": "numberValue",
"value": 9.11,
"text": "$9.11",
"elements": [
{
"$ref": "#/recognitionResults/0/lines/32/words/0"
},
{
"$ref": "#/recognitionResults/0/lines/32/words/1"
}
]
},
"Tax": {
"valueType": "numberValue",
"value": 0.88,
"text": "$0.88",
"elements": [
{
"$ref": "#/recognitionResults/0/lines/31/words/0"
},
{
"$ref": "#/recognitionResults/0/lines/31/words/1"
},
{
"$ref": "#/recognitionResults/0/lines/31/words/2"
}
]
},
"MerchantAddress": null,
"MerchantName": {
"valueType": "stringValue",
"value": "Chick-fil-a",
"text": "Chick-fil-a",
"elements": [
{
"$ref": "#/recognitionResults/0/lines/0/words/2"
}
]
},
"MerchantPhoneNumber": {
"valueType": "stringValue",
"value": "+13092689500",
"text": "309-268-9500",
"elements": [
{
"$ref": "#/recognitionResults/0/lines/4/words/0"
}
]
},
"TransactionDate": {
"valueType": "stringValue",
"value": "2019-06-21",
"text": "6/21/2019",
"elements": [
{
"$ref": "#/recognitionResults/0/lines/6/words/0"
}
]
},
"TransactionTime": {
"valueType": "stringValue",
"value": "13:00:57",
"text": "1:00:57 PM",
"elements": [
{
"$ref": "#/recognitionResults/0/lines/6/words/1"
},
{
"$ref": "#/recognitionResults/0/lines/6/words/2"
}
]
}
}
}
]
}
More details on Form Recognizer: https://azure.microsoft.com/en-us/services/cognitive-services/form-recognizer/

Kibana: searching for a specific phrase, returns without results, while another search returns the phrase

Looks like a simple usecase but for some reason I just can't figure out how to do this, or google a clear example.
Lets say I have a message stored in logstash
message:
"info: 2015-11-28 22:02:19,232:common:INFO:ENV: Production
User:None:Username:None:LOG: publishing to bus "
And I want to search in kibana (version 4) for the phrase:"publishing to bus"
I'll get a set of results
But if I'll search for: "None:LOG: publishing to bus"
Then I get "No results found".
While Obviously this phrase does exists and is returned by the previous search.
So my question is basically - What is going on? What is the correct way to search for a possible long phrase and why does the second example fail.
EDIT:
The stored JSON.
{
"_index": "logz-ngdxrkmolklnvngumaitximbohqwbocg-151206_v1",
"_type": "django_logger",
"_id": "AVF2DPxZZst_8_8_m-se",
"_score": null,
"_source": {
"log": " publishing to bus {'user_id': 8866, 'event_id': 'aibRBPcLxcAzsEVRtFZVU5', 'timestamp': 1449384441, 'quotes': {}, 'rates': {u'EURUSD': Decimal('1.061025'), u'GBPUSD': Decimal('1.494125'), u'EURGBP': Decimal('0.710150')}, 'event': 'AccountInstrumentsUpdated', 'minute': 1449384420}",
"logger": "common",
"log_level": "INFO",
"message": "2015-12-06 06:47:21,298:common:INFO:ENV: Production User:None:Username:None:LOG: publishing to bus {'user_id': 8866, 'event_id': 'aibRBPcLxcAzsEVRtFZVU5', 'timestamp': 1449384441, 'quotes': {}, 'rates': {u'EURUSD': Decimal('1.061025'), u'GBPUSD': Decimal('1.494125'), u'EURGBP': Decimal('0.710150')}, 'event': 'AccountInstrumentsUpdated', 'minute': 1449384420}",
"type": "django_logger",
"tags": [
"celery"
],
"path": "//path/to/logs/out.log",
"environment": "Staging",
"#timestamp": "2015-12-06T06:47:21.298+00:00",
"user_id": "None",
"host": "path.to.host",
"timestamp": "2015-12-06 06:47:21,298",
"username": "None"
},
"fields": {
"#timestamp": [
1449384441298
]
},
"highlight": {
"message": [
"2015-12-06 06:47:21,298:common:INFO:ENV: Staging User:None:Username:None:LOG: #kibana-highlighted-field#publishing#/kibana-highlighted-field# #kibana-highlighted-field#to#/kibana-highlighted-field# #kibana-highlighted-field#bus#/kibana-highlighted-field# {'user_id': **, 'event_id': 'aibRBPcLxcAzsEVRtFZVU5', 'timestamp': 1449384441, 'quotes': {}, 'rates': {u'EURUSD': Decimal('1.061025'), u'GBPUSD': Decimal('1.494125'), u'EURGBP': Decimal('0.710150')}, 'event': 'AccountInstrumentsUpdated', 'minute': 1449384420}"
]
},
"sort": [
1449384441298
]
}
Accodrding to Elasticsearch, it uses standard analyzer as default. The standard analyzer tokenizes the message field as follows:
"2015-12-06 06:47:21,298:common:INFO:ENV: Production
User:None:Username:None:LOG: publishing to bus {'user_id': 8866,
'event_id': 'aibRBPcLxcAzsEVRtFZVU5', 'timestamp': 1449384441,
'quotes': {}, 'rates': {u'EURUSD': Decimal('1.061025'), u'GBPUSD':
Decimal('1.494125'), u'EURGBP': Decimal('0.710150')}, 'event':
'AccountInstrumentsUpdated', 'minute': 1449384420}"
{
"tokens": [
{
"token": "2015",
"start_offset": 0,
"end_offset": 4,
"type": "<NUM>",
"position": 0
},
{
"token": "12",
"start_offset": 5,
"end_offset": 7,
"type": "<NUM>",
"position": 1
},
{
"token": "06",
"start_offset": 8,
"end_offset": 10,
"type": "<NUM>",
"position": 2
},
{
"token": "06",
"start_offset": 11,
"end_offset": 13,
"type": "<NUM>",
"position": 3
},
{
"token": "47",
"start_offset": 14,
"end_offset": 16,
"type": "<NUM>",
"position": 4
},
{
"token": "21,298",
"start_offset": 17,
"end_offset": 23,
"type": "<NUM>",
"position": 5
},
{
"token": "common:info:env",
"start_offset": 24,
"end_offset": 39,
"type": "<ALPHANUM>",
"position": 6
},
{
"token": "production",
"start_offset": 41,
"end_offset": 51,
"type": "<ALPHANUM>",
"position": 7
},
{
"token": "user:none:username:none:log",
"start_offset": 52,
"end_offset": 79,
"type": "<ALPHANUM>",
"position": 8
},
{
"token": "publishing",
"start_offset": 81,
"end_offset": 91,
"type": "<ALPHANUM>",
"position": 9
},
{
"token": "to",
"start_offset": 92,
"end_offset": 94,
"type": "<ALPHANUM>",
"position": 10
},
{
"token": "bus",
"start_offset": 95,
"end_offset": 98,
"type": "<ALPHANUM>",
"position": 11
},
{
"token": "user_id",
"start_offset": 100,
"end_offset": 107,
"type": "<ALPHANUM>",
"position": 12
},
{
"token": "8866",
"start_offset": 109,
"end_offset": 113,
"type": "<NUM>",
"position": 13
},
{
"token": "event_id",
"start_offset": 115,
"end_offset": 123,
"type": "<ALPHANUM>",
"position": 14
},
{
"token": "aibrbpclxcazsevrtfzvu5",
"start_offset": 125,
"end_offset": 147,
"type": "<ALPHANUM>",
"position": 15
},
{
"token": "timestamp",
"start_offset": 149,
"end_offset": 158,
"type": "<ALPHANUM>",
"position": 16
},
{
"token": "1449384441",
"start_offset": 160,
"end_offset": 170,
"type": "<NUM>",
"position": 17
},
{
"token": "quotes",
"start_offset": 172,
"end_offset": 178,
"type": "<ALPHANUM>",
"position": 18
},
{
"token": "rates",
"start_offset": 184,
"end_offset": 189,
"type": "<ALPHANUM>",
"position": 19
},
{
"token": "ueurusd",
"start_offset": 192,
"end_offset": 199,
"type": "<ALPHANUM>",
"position": 20
},
{
"token": "decimal",
"start_offset": 201,
"end_offset": 208,
"type": "<ALPHANUM>",
"position": 21
},
{
"token": "1.061025",
"start_offset": 209,
"end_offset": 217,
"type": "<NUM>",
"position": 22
},
{
"token": "ugbpusd",
"start_offset": 220,
"end_offset": 227,
"type": "<ALPHANUM>",
"position": 23
},
{
"token": "decimal",
"start_offset": 229,
"end_offset": 236,
"type": "<ALPHANUM>",
"position": 24
},
{
"token": "1.494125",
"start_offset": 237,
"end_offset": 245,
"type": "<NUM>",
"position": 25
},
{
"token": "ueurgbp",
"start_offset": 248,
"end_offset": 255,
"type": "<ALPHANUM>",
"position": 26
},
{
"token": "decimal",
"start_offset": 257,
"end_offset": 264,
"type": "<ALPHANUM>",
"position": 27
},
{
"token": "0.710150",
"start_offset": 265,
"end_offset": 273,
"type": "<NUM>",
"position": 28
},
{
"token": "event",
"start_offset": 277,
"end_offset": 282,
"type": "<ALPHANUM>",
"position": 29
},
{
"token": "accountinstrumentsupdated",
"start_offset": 284,
"end_offset": 309,
"type": "<ALPHANUM>",
"position": 30
},
{
"token": "minute",
"start_offset": 311,
"end_offset": 317,
"type": "<ALPHANUM>",
"position": 31
},
{
"token": "1449384420",
"start_offset": 319,
"end_offset": 329,
"type": "<NUM>",
"position": 32
}
]
}
The phrase "Production User:None:Username:None:LOG: publishing to bus "
{
"token": "production",
"start_offset": 41,
"end_offset": 51,
"type": "<ALPHANUM>",
"position": 7
},
{
"token": "user:none:username:none:log",
"start_offset": 52,
"end_offset": 79,
"type": "<ALPHANUM>",
"position": 8
},
{
"token": "publishing",
"start_offset": 81,
"end_offset": 91,
"type": "<ALPHANUM>",
"position": 9
},
{
"token": "to",
"start_offset": 92,
"end_offset": 94,
"type": "<ALPHANUM>",
"position": 10
},
{
"token": "bus",
"start_offset": 95,
"end_offset": 98,
"type": "<ALPHANUM>",
"position": 11
}
So if you search "publishing to bus" the elasticsearch matches the above three token and return the document.
if you search "None:LOG: publishing to bus" "None:LOG:" doesn't match fully so it doesn't return the document.
you can try "User:None:Username:None:LOG: publishing to bus" to get the result.
There are some problems in Kibana with special character as : | and -. When kibana found that kind of character they save in different parts, not in the same field. For that is easy to find publishing to bus or None or log. The solution is that you must indicate to kibana that the field wil not be analyzed.

Resources