Reputation: 367
I am unable to figure out what is wrong with below query.
GET website/_search
{
"query": {
"bool": {
"filter": [
{
"range": {
"@timestamp": {
"gte": "now-1d/d",
"lt": "now/d"
}
},
"match": {
"aspnet-request-url.keyword": "abc.com/Default.aspx"
}
}
]
}
}
}
Both range
and match
are working fine independently.
As per documentation, it says when merging more than one query we should use either must
, filter
, must-not
under bool
query.
Still it is giving [range] malformed query, expected [END_OBJECT] but found [FIELD_NAME]
.
Any help is appreciated.
Upvotes: 1
Views: 476
Reputation: 16192
[range] malformed query, expected [END_OBJECT] but found [FIELD_NAME]
It is clear from the above error, that the query is not properly formed. Please refer to this to know more about the structure of the query and filter context.
You are missing some brackets, try out the below search query
{
"query": {
"bool": {
"filter": [
{
"range": {
"@timestamp": {
"gte": "now-1d/d",
"lt": "now/d"
}
}
},
{ <-- note this
"match": {
"aspnet-request-url.keyword": "abc.com/Default.aspx"
}
}
]
}
}
}
Upvotes: 1