Query_shard_exception failed to execute query on datetime field

Hi guys,
I have this node:

{ "_index" : "impasti",
"_type" : "impasti",
"_id" : "2019-01-02T15:25:20",
"_score" : 1.9806902,
"_source" : {
  "sensor" : "Temperature",
  "mac_address" : "",
  "time" : "2019-01-02T14:25:19.728709Z",
  "unit" : "'C",
  "value" : 20.937
}},

I try this query:

POST /impasti/impasti/_search
{
'query':{
    "query_string": {
        "default_field": "time",
        "query": "2019-01-02T14:25:19.728709Z"
         }
    }
}

But the response is:

"type": "query_shard_exception", 
"reason": "Failed to parse query [2019-01-02T14:25:19.728709Z]",

Where is the mistake?
Thanks guys

I found the answer. I must declare the type of terms.
"query": "time:[2019-01-02T14:25:19.728709Z TO 2019-01-02T14:25:19.728709Z]"

But, if I want add the filter on the query_string I have this message:

"reason": "no [query] registered for [filtered]"

This is my POST:

POST /impasti/impasti/_search
{
  "query":   {
    "filtered": {
        "query": {
          "query_string": {
              "default_field": "time",
              "query": "time:[2019-01-02T14:20:19.728709Z TO 2019-02-02T14:25:19.728709Z]"
              }
            }, 
        
      "filter":
      {
          "term":{ "sensor": "temperature" }
      }
    }
  }
}

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.