I am working on a project concerning cooking recipes. I installed Elasticsearch 1.5.2 and I added a lot of products such as vegetables or meats in many indexes of supermarkets. All was well until I started aggregations queries. For example: to make a mash potatoes I need potatoes, beans, chickpeas, broccoli, milk, pepper, salt. I have all this products stored. I need to make one query to search the cheapest of this products in all indexes. I tried many queries but I didn't find what I need.
This is the example, all these queries works but I need their results in one query:
POST /_search
{
"query": {
"query_string": {
"query": "pommes de terre",
"fields": [
"titre"
]
}
},
"sort" : [
{"prix en €/kg" : {"order" : "asc"}}
]
}
POST /_search
{
"query": {
"query_string": {
"query": "haricots",
"fields": [
"titre"
]
}
},
"sort" : [
{"prix en €/kg" : {"order" : "asc"}}
]
}
POST /_search
{
"query": {
"query_string": {
"query": "pois chiche",
"fields": [
"titre"
]
}
},
"sort" : [
{"prix en €/kg" : {"order" : "asc"}}
]
}
POST /_search
{
"query": {
"query_string": {
"query": "brocoli",
"fields": [
"titre"
]
}
},
"sort" : [
{"prix en €/kg" : {"order" : "asc"}}
]
}
POST /_search
{
"query": {
"query_string": {
"query": "lait",
"fields": [
"tags"
]
}
},
"sort" : [
{"prix en €/L" : {"order" : "asc"}}
]
}
POST /_search
{
"query": {
"query_string": {
"query": "poivre",
"fields": [
"tags"
]
}
},
"sort" : [
{"prix en €/kg" : {"order" : "asc"}}
]
}
POST /_search
{
"query": {
"query_string": {
"query": "sel",
"fields": [
"tags"
]
}
},
"sort" : [
{"prix en €/kg" : {"order" : "asc"}}
]
}
I want to have only one query to fetch the results of all these queries and I only want the cheapest ones, not all the lists.