Sorting by date_range


(Ladislav Bugar) #1

Is it possible to sort by "date_range" field?
If yes, how?

Mapping:

PUT testindex
{
  "mappings": {
    "datetest": {
      "properties": {
        "created": {
          "type": "date"
        },
        "id": {
          "type": "keyword"
        },
        "Name": {
          "type": "keyword"
        },
        "dater": {
					"type": "date_range"
				}      
      }  
    }
  }
}

query:

GET /testindex/_search
{
 "query": {
    "match_all": {}
  },
  "sort": [
    {
      "dater": {
        "order": "desc"
      }
    }
  ]
}

result:

    error": {
        "root_cause": [
          {
            "type": "illegal_argument_exception",
            "reason": "Fielddata is not supported on field [dater] of type [date_range]"
          }
        ]
    }

thank you very much


(system) #2

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