Reputation: 3358
I am trying to get the records which match a specific field with between 2 dates as below
{
"query": {
"bool": {
"must": [
{
"range": {
"createdtime": {
"gte": "now-1y",
"lte": "now",
"boost" : 2.0
}
}
},
{
"match": {
"id": 350403
}
}
]
}
}
"size" : 10000,
"from": 0,
"sort": { "createdtime" : {"order" : "desc"} }
but it throws the exception, can anyone help to fix it?
Upvotes: 3
Views: 6159
Reputation: 217294
You should properly format and indent your query, it's easier to spot errors. The correct query can be found below:
{
"query": {
"bool": {
"must": [
{
"range": {
"createdtime": {
"gte": "now-1y",
"lte": "now",
"boost": 2
}
}
},
{
"match": {
"id": 350403
}
}
]
}
},
"size": 10000,
"from": 0,
"sort": {
"createdtime": {
"order": "desc"
}
}
}
Upvotes: 6