Is _xpack/sql support to search from alias?


(Gaurav Patel) #1

Hi, In my project i am transforming user query to SQL statement for dynamic search.

As _xpack/sql support to execute sql statement, i can directly or with minimum changes use my existing tested functionality with elastic search.

Wanted to know that is _xpack allow to search in Alias to search from all indexes? is their any way to achieve this using _xpack/sql?

e.g
POST _xpack/sql
{
"query": "SELECT * FROM [Alias Name]"
}


(Andrei Stefan) #2

Hi @Gaurav_Patel,

Yes, this is possible. In fact, we rely on Elasticsearch's own index name resolution to perform the searches.

Please, note, that at the moment (the latest released version) if the searched indices don't have identical mappings, the query won't work. In the very near versions, searching indices with different mappings will be possible, thanks to this PR pending reviews at the moment. One thing to keep in mind: this doesn't mean you could run join kind-of queries. "Different mappings" here means that the indices can have different fields, but those fields with the same name, must have the same mapping.


(system) #3

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.