My query is running insanely slow. This one is over 1.3 seconds with just one should matches and I need 3-4 more which can take it up to 14-15 seconds! First I run a store search to yield a set of menuIds to filter against in an items index.
Shouldn't ES perform the filter first and then search against those documents. My index has over 3 million documents which doesn't seem long and I'm only searching against one or a few fields which are indexed. It almost seems like a full text search is occurring without index. Could the synonyms included in the mapping be contributing this problem?
Here is a link to the mapping and long profile query result: https://drive.google.com/open?id=1yaFFKutDYiwlTdjseZZqIijCrUXncyzf
Here's the query:
GET /item/_doc/_search
{
"profile": true,
"query": {
"bool": {
"filter": {
"terms": {
"menuId": [
"1362806",
"1220659",
"1220282",
"1410886",
"1408407",
"1220203",
"1362729",
"1389199",
"1230880",
"1222243",
"1226957",
"1187670",
"1226979",
"1223458",
"1222824",
"1303641",
"1220260",
"1226806",
"1226635",
"1226987",
"1187857",
"1224780",
"1345293",
"1367150",
"1219483",
"1367476",
"1265920",
"1226960",
"1367486",
"1222986",
"1409449",
"1223819",
"1227004",
"1396947",
"1396899",
"1226976",
"1409786",
"1220517",
"1280015",
"1219434",
"1409491",
"1307692",
"1219721",
"1410684",
"1227037",
"1401613",
"1221572",
"1224560",
"1223365",
"1411075",
"1225831",
"1410090",
"1374307",
"1255994",
"1226986",
"1363398",
"1227332",
"1410279",
"1401560",
"1409946",
"1226996",
"1399023",
"1253851",
"1410280",
"1221602",
"1268223",
"1226394",
"1219534",
"1304872",
"1410880",
"1372924",
"1307391",
"1227826",
"1223129",
"1393406",
"1222275",
"1409495",
"1295376",
"1347656",
"1410078",
"1220572",
"1311836",
"1409484",
"1410077",
"1295066",
"1305062",
"1214538",
"1409485",
"1219827",
"1304871",
"1363298",
"1224902",
"1410505",
"1279475",
"1222201",
"1225956",
"1386873",
"1221805",
"1220307",
"1226974",
"1222328",
"1410485",
"1221940",
"1253502",
"1399371"
]
}
},
"minimum_should_match": 1,
"should": [
{
"match": {
"name": {
"query": "chicken pot pie",
"operator": "and",
"fuzziness": "AUTO",
"prefix_length": 2,
"boost": 1100
}
}
}
]
}
}
}