Skip to content

Terms aggregations parse failure for date and ip fields #17705

@markharwood

Description

@markharwood

The include clause on the terms and significant_terms aggregations has a parse failure for string values provided for date and ip field types.
Steps to reproduce:

PUT test
{
   "settings": {
      "number_of_replicas": 0,
      "number_of_shards":1
   },
   "mappings": {
      "test": {

         "properties": {
            "stringField": {
               "type": "string"
            },
            "dateTimeField": {
               "type": "date",
                "format": "date_time"
            },
            "ipField": {
               "type": "ip"
            }
         }
      }
   }
}

POST test/test
{"stringField":"bar","ipField":"192.168.1.0", "dateTimeField":"2016-04-11T14:02:39.593Z"}

GET test/_search
{
    "size":0,
   "aggs": {
      "this_works": {
         "terms": {
            "field": "stringField",
            "include":["bar"]            
         }
      }
   }
}
GET test/_search
{
    "size":0,
   "aggs": {
      "this_does_not_work": {
         "terms": {
            "field": "ipField",
            "include":["192.168.1.0"]

         }
      }
   }
}
GET test/_search
{
    "size":0,
   "aggs": {
      "this_does_not_work": {
         "terms": {
            "field": "dateTimeField",
            "include":["2016-04-11T14:02:39.593Z"]

         }
      }
   }
}

The error returned is of the following type

{
   "error": {
      "root_cause": [
         {
            "type": "number_format_exception",
            "reason": "For input string: \"2016-04-11T14:02:39.593Z\""
         }
      ],
      "type": "search_phase_execution_exception",
      "reason": "all shards failed",
      "phase": "query_fetch",
      "grouped": true,
      "failed_shards": [
         {
            "shard": 0,
            "index": "test",
            "node": "Qz_UtnGzTOeYEDLeOgTQLw",
            "reason": {
               "type": "number_format_exception",
               "reason": "For input string: \"2016-04-11T14:02:39.593Z\""
            }
         }
      ]
   },
   "status": 400
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions