Abhishek Ekaanth
Abhishek Ekaanth

Reputation: 2567

Get data from 3 different indexes in the Elastic search?

I was successfully able to get data from an individual index, but now I will have to get the data from 3 indexes, those 3 indexes are of different types (Student, Employee, School). With a single query trigger can I be able to get data from all the three index.

Upvotes: 2

Views: 826

Answers (1)

Vova Bilyachat
Vova Bilyachat

Reputation: 19514

In es you can specify that by URL

POST /gb,us/user,tweet/_search
{
//YOur query
}

In your case if you have one type per index it could be

POST /Student,Employee,School/_search

More info here

In Java according to this you should have smth like this

QueryBuilders.indicesQuery(queryBuilder, "product-a", "product-b");

Upvotes: 4

Related Questions