I have a response from an OCR application which is a JSON similar to Google Vision OCR response. I want to put this in Elasticsearch in order to perform a shape query. Although I am able to put the JSON in Elasticsearch, I am not able to come up with a perfect schema and mapping to perform a search on the basis of the shape or the boundingPoly and the bgColor.
I am pretty new to Elasticsearch and I have few questions.
(1) How can I perform search on the basis of the boundingPoly and bgColor?
(2) Do I need to change the schema for performing the search or can I keep it as it is? What the best schema and mapping that suits my purpose?
(3) Also, I would like to perform a search on the basis of bgColor. How can I achieve this?
I tried with Geo-shape query but failed to implement it with the proper result. Also, there is a restriction in
Geo-shape querythat the values must lie between 90 - 180. I think that part we can handle by normalizing the values.
Sample JSON:
{
"responses": [{
"textAnnotations": [{
"description": "were",
"boundingPoly": {
"vertices": [{
"x": 112,
"y": 5
},
{
"x": 333,
"y": 5
},
{
"x": 333,
"y": 93
},
{
"x": 112,
"y": 93
}
],
"confidence": 99
},
"wordInfo": {
"length": 4,
"width": 221,
"height": 88,
"bgColor": [
255,
255,
251
]
}
},
{
"description": "gonna",
"boundingPoly": {
"vertices": [{
"x": 338,
"y": 5
},
{
"x": 589,
"y": 5
},
{
"x": 589,
"y": 93
},
{
"x": 338,
"y": 93
}
],
"confidence": 99
},
"wordInfo": {
"length": 5,
"width": 251,
"height": 88,
"bgColor": [
255,
255,
255
]
}
}
]
}]
}
Thanks in advance!