Skip to content

Inconsistent behavior when loading docvalues for range fields #53246

Closed
@jtibshirani

Description

@jtibshirani

Say we've indexed a document with an integer_range and date_range using version 7.4 (or above):

PUT range_index
{
  "mappings": {
    "properties": {
      "expected_attendees": {
        "type": "integer_range"
      },
      "time_frame": {
        "type": "date_range", 
        "format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis"
      }
    }
  }
}

PUT range_index/_doc/1?refresh
{
  "expected_attendees" : { 
    "gte" : 10,
    "lte" : 20
  },
  "time_frame" : { 
    "gte" : "2015-10-31 12:00:00", 
    "lte" : "2015-11-01"
  }
}

If we specify "docvalues_fields": ["time_frame"] during a search, we get an unsupported operation exception because of a failure in DocValueFormat.format:

Caused by: java.lang.UnsupportedOperationException
	at org.elasticsearch.search.DocValueFormat.format(DocValueFormat.java:70) ~[elasticsearch-7.4.1.jar:7.4.1]
	at org.elasticsearch.search.fetch.subphase.DocValueFieldsFetchSubPhase.hitsExecute(DocValueFieldsFetchSubPhase.java:159) ~[elasticsearch-7.4.1.jar:7.4.1]
	at org.elasticsearch.search.fetch.FetchPhase.execute(FetchPhase.java:177) ~[elasticsearch-7.4.1.jar:7.4.1]

When specifying "docvalues_fields": ["expected_attendees"], we don't get an error but a binary representation is returned.

This behavior seems quite confusing. To me it would be best if we either (1) always returned a nicely formatted representation of the range, or (2) always threw a descriptive error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    :Analytics/AggregationsAggregations:Search/SearchSearch-related issues that do not fall into other categories>bugTeam:AnalyticsMeta label for analytical engine team (ESQL/Aggs/Geo)Team:SearchMeta label for search team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions