Reputation: 25418
I have this query that only works when I query for one field, but if I try to query range for two fields it throws an error:
{
"query": {
"range" : {
"date" : {
"gt" : "18/05/2017",
"lt" : "19/05/2017"
}
},
"range": {
"number_of_cyclist_killed" : {
"gt" : 0
}
}
}
}
How can I query where number of cyclists > 0
and also in the date range?
Upvotes: 0
Views: 24
Reputation: 52366
Try this:
{
"query": {
"bool": {
"must": [
{
"range": {
"date": {
"gt": "18/05/2017",
"lt": "19/05/2017"
}
}
},
{
"range": {
"number_of_cyclist_killed": {
"gt": 0
}
}
}
]
}
}
}
Upvotes: 3