Skip to content

Instantly share code, notes, and snippets.

@Shelob9
Created September 17, 2021 14:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Shelob9/dfbd0276c46df86682b1cf12cc429886 to your computer and use it in GitHub Desktop.
Save Shelob9/dfbd0276c46df86682b1cf12cc429886 to your computer and use it in GitHub Desktop.
{
"mapping": {
"properties": {
"eventType": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"siteId": {
"type": "long"
},
"siteUrl": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"time": {
"type": "date",
"format": "yyyy/MM/dd HH:mm:ss||yyyy/MM/dd||epoch_millis"
}
}
}
}
This works:
GET team_1/_search
{
"query" : {
"match" : {
"eventType" : "login"
}
},
"sort": { "time": "desc"}
}
This errors:
GET team_1/_search
{
"query" : {
"match" : {
"eventType" : "login"
},
"filter" : {
"range" : {
"lte" : {
"time" : "2021/01/01"
}
}
}
},
"sort": { "time": "desc"}
}
{
"error": {
"root_cause": [
{
"type": "parsing_exception",
"reason": "[match] malformed query, expected [END_OBJECT] but found [FIELD_NAME]",
"line": 6,
"col": 7
}
],
"type": "parsing_exception",
"reason": "[match] malformed query, expected [END_OBJECT] but found [FIELD_NAME]",
"line": 6,
"col": 7
},
"status": 400
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment