POST my_test_ndex/_doc/
{
"field1": {
"subFieldA": 1,
"subFieldB": 2
},
"field2": {
"subFieldA": 1,
"subFieldB": 2
}
}
// Exception
POST _opendistro/_sql
{
"query": """SELECT field2.* FROM
my_test_ndex as i
WHERE
i.field1.subFieldA <i.field1.subFieldB
LIMIT 50;"""
}
---->>
{
"error": {
"reason": "Error occurred in Elasticsearch engine: all shards failed",
"details": """Shard[0]: ScriptException[runtime error]; nested: IllegalArgumentException[No field found for [subFieldA] in mapping with types []];
For more details, please send request for Json format to see the raw response from elasticsearch engine.""",
"type": "SearchPhaseExecutionException"
},
"status": 400
}
// Exception
POST _opendistro/_sql
{
"query": """SELECT field1.* FROM
my_test_ndex as i
WHERE
i.field1.subFieldA <i.field1.subFieldB
LIMIT 50;"""
}
------->>
{
"error": {
"reason": "Error occurred in Elasticsearch engine: all shards failed",
"details": """Shard[0]: ScriptException[runtime error]; nested: IllegalArgumentException[No field found for [subFieldA] in mapping with types []];
For more details, please send request for Json format to see the raw response from elasticsearch engine.""",
"type": "SearchPhaseExecutionException"
},
"status": 400
}
These instead work:
POST _opendistro/_sql
{
"query": """SELECT * FROM
my_test_ndex as i
WHERE
i.field1.subFieldA <i.field1.subFieldB
LIMIT 50;"""
}
POST _opendistro/_sql
{
"query": """SELECT field1 FROM
my_test_ndex as i
WHERE
i.field1.subFieldA <i.field1.subFieldB
LIMIT 50;"""
}
POST _opendistro/_sql
{
"query": """SELECT field2 FROM
my_test_ndex as i
WHERE
i.field1.subFieldA <i.field1.subFieldB
LIMIT 50;"""
}
Thank @penghuo for the #795 fix!
a follow up on this.
When using * in a subfield (non-nested), breaks
These instead work: