I am using the below query to get the data from 2 Indices, but I am getting this error "Queries with multiple indices are not supported". myindex1 and myindex2 structures are identical. I am using Elasticsearch Ver 7.10.2 under Windows 10. Can some one please help me...Thanks in advance.
THIS IS MY QUERY
POST /_sql?format=json
{
"query": "select field1, field2, field3 from myindex1, myindex2 where field1='DATA1' "
}
THIS IS MY ERROR
{
"error" : {
"root_cause" : [
{
"type" : "mapping_exception",
"reason" : "Queries with multiple indices are not supported"
}
],
"type" : "mapping_exception",
"reason" : "Queries with multiple indices are not supported"
},
"status" : 400
}
Using the standard search API would work, but there's a way with SQL too, by using index patterns:
select field1, field2, field3 from "myindex*" where field1='DATA1'
As long as the mappings aren't conflicting (ex: same field name defined of incompatible types in different indices), SQL will "merge" the mappings and query all matching indices.
Thanks for your reply... I have tried your code... Its not working, can you please tell me where I am doing wrong.... I have tried with double quotes and single quotes too... Please correct this code...
POST /_sql?format=json
{
"query" : select field1, field2, field3 from "myindex*" where field1='DATA1'
}
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.