Hi guys,
I would like to know if it is possible to make a query based off the result of another query.
For example, there are indices for school and students.
School
{
"settings": { ... },
"mappings": {
"properties": {
"schoolId":{
"type":"keyword"
},
"students":{
"type":"keyword" //array of student ids
},
...
}
}
}
Students
{
"settings": { ... },
"mappings": {
"properties": {
"studentId":{
"type":"keyword"
},
"firstName":{
"type":"text"
},
...
}
}
}
If I would like to get all the schools that have the students whose first name is "John," is there any way that I can make a query to get the student ids with a name with "John" and get all the schools based on the results?
I think it would be similar to make sub queries in SQL, but I cannot find a way in Elasticsearch.
Is it possible in elastic query? If it is, then how should I make a query?