Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Issues in querying nested objects #1138

Open
newUserForTesting opened this issue Aug 28, 2021 · 1 comment
Open

Issues in querying nested objects #1138

newUserForTesting opened this issue Aug 28, 2021 · 1 comment

Comments

@newUserForTesting
Copy link

newUserForTesting commented Aug 28, 2021

Hello Experts,

Our Index Mapping has several nested structures and objects within it. Just to showcase the issue, please consider the following sample mapping

PUT /sample_order
{
"mappings": {
"properties": {
"orderNo":{
"type": "text"
},
"orderLines": {
"type": "nested",
"properties": {
"item": {
"type": "object",
"properties": {
"itemDesc": {
"type": "text"
},"itemID": {
"type": "integer"
}
}
}
}
}
}
}
}

POST /sample_order/_bulk
{"index":{"_id":1}}
{"orderNo":"1","orderLines":[{"item":{"itemDesc":"SampleItemDesc1","itemID":11}}]}
{"index":{"_id":2}}
{"orderNo":"2","orderLines":[{"item":{"itemDesc":"SampleItemDesc2","itemID":22}}]}

Now if we want to run following query:
{
"query": "SELECT * FROM sample_order where orderLines.item.itemID=11",
"fetch_size": 10
}
It doesn't return any records.

If we change it to:
{
"query": "SELECT * FROM sample_order where nested(orderLines.item.itemID)=11",
"fetch_size": 10
}
It throws error mentioning:
nested object under path [orderLines.item] is not of nested type

How can we query objects inside nested structures?
Could you please assist in this Experts. We really appreciate your help!

Thanks!

@newUserForTesting
Copy link
Author

Could someone please assist in the above query? Appreciate the help.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant