I have following data set indexed in my elasticsearch
{
"title": "Professor",
"class": [6001, 6015, 6018],
"subject": [5010, 5012, 5013],
"salary": 12500
}
{
"title": "Professor",
"class": [6012, 6013, 6014],
"subject": [5010, 5005, 5004],
"salary": 16600
}
{
"title": "Principal",
"class": [7001, 7010, 6018],
"subject": [5010, 5012, 5013],
"salary": 14750
}
{
"title": "Asst Professor",
"class": [6012, 6013, 6014],
"subject": [5010, 5005, 5004],
"salary": 16600
}
I'm trying to search
class - 6001 OR 6018 OR 6013 AND subject - 5013 OR 5004 AND salary (range) - 12000 to 15000
I'm using below query
{
"query" : {
"filtered" : {
"filter" : {
"bool" : {
"must" : [
{ "term" : {"class" : [6001, 6018, 6013]}},
{ "term" : {"subject" : [5013, 5004]}},
{"range" : {"salary" : {"gte": 12000,"lte": 15000}}}
]
}}}}}
But I'm not getting the result that Im expecting, what is wrong in this?