Skip to content

Doing a min aggregation on a daterange type #33712

@Burgov

Description

@Burgov

Describe the feature:

Elasticsearch version (bin/elasticsearch --version): 6.4.0

Plugins installed: []

JVM version (java -version): not sure

OS version (uname -a if on a Unix-like system): any

Description of the problem including expected versus actual behavior:

I would like to get the lowest value in a daterange type, but there seems to be no way to do so.

Steps to reproduce:

PUT test
{
  "mappings": {
    "test": {
      "properties": {
        "dr": {
          "type": "date_range"
        }
      }
    }
  }
}

POST test/test
{
  "dr": {
    "gte": "2018-07-01",
    "lt": "2018-11-01"
  }
}

POST test/test/_search
{
  "aggs": {
    "min": {
      "min": {
        "field": "dr.gte"
      }
    }
  }, 
  "query": {
    "match_all": {}
  }
}

The desired output would be something like this:

  "aggregations": {
    "min": {
      "value": "2018-07-01"
    }
  }

But instead, it is


  "aggregations": {
    "min": {
      "value": null
    }
  }

Am i doing something wrong or is this not supported?

Provide logs (if relevant):

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions