Hi! I need to query elements for a specific month in a date field.
For that, I'm trying my first ES|QL query, as follows:
{
"query": """
FROM facts
| WHERE DATE_PART('month', date_start) = '06'
"""
}
by doing a POST to /_query?format=txt , using Postman.
If I define the raw body as Text, I get this error:
{
"error": "Content-Type header [text/plain] is not supported",
"status": 406
}
And if I try JSON, I get a different error about incorrect format (see below). How should I configure it to be accepted by ES?
{
"error": {
"root_cause": [
{
"type": "x_content_parse_exception",
"reason": "[2:16] Unexpected character ('\"' (code 34)): was expecting comma to separate Object entries\n at [Source: (byte[])\"{\r\n \"query\": \"\"\"\r\nFROM facts\r\n| WHERE DATE_PART('month', date_start) = '06'\r\n \"\"\"\r\n}\"; line: 2, column: 16]"
}
],
"type": "x_content_parse_exception",
"reason": "[2:16] Unexpected character ('\"' (code 34)): was expecting comma to separate Object entries\n at [Source: (byte[])\"{\r\n \"query\": \"\"\"\r\nFROM facts\r\n| WHERE DATE_PART('month', date_start) = '06'\r\n \"\"\"\r\n}\"; line: 2, column: 16]",
"caused_by": {
"type": "json_parse_exception",
"reason": "Unexpected character ('\"' (code 34)): was expecting comma to separate Object entries\n at [Source: (byte[])\"{\r\n \"query\": \"\"\"\r\nFROM facts\r\n| WHERE DATE_PART('month', date_start) = '06'\r\n \"\"\"\r\n}\"; line: 2, column: 16]"
}
},
"status": 400
}