Hi all
Let's say I have documents of the following structure:
Product {
organization;
supplier;
name;
}
and there are billions of documents, a lot of organizations, and each organization has approximately 100000 products . and when searching for products in particular organization by name, It seems to me that it's beneficial to make ElasticSearch first filter out products by organization and then, having only 100000 products out of billions, search by name.
I tried to accomplish this the following way:
{
"query":{
"bool":{
"must":[
{
"term":{
"name":{
"value":"test"
}
}
}
],
"filter":[
{
"term":{
"organization":"123"
}
}
]
}
}
}
but have got worse results in terms of performance that using this query:
{
"query":{
"bool":{
"must":[
{
"term":{
"name":{
"value":"test"
}
}
},
{
"term":{
"organization":{
"value":"123"
}
}
}
]
}
}
}
Can anybody explain why? And any suggestions how to achieve my goal?