elasticsearch icon indicating copy to clipboard operation
elasticsearch copied to clipboard

Allow specifying field names for operators of range field types

Open mitar opened this issue 2 years ago • 3 comments

Description

For example, currently for integer_range field one has to provide such a value object:

"expected_attendees" : { 
    "gte" : 10,
    "lt" : 20
}

I would propose that one could define for the field names for gte, lt, etc., operators. So that I could provide also:

"expected_attendees" : { 
    "min" : 10,
    "max" : 20
}

Ideally, I could also have additional fields in the object, which would be ignored, but could be specified as fields for other indices, e.g.:

{
  "name": "foobar",
  "min_price": 10,
  "max_price": 20
}

mitar avatar Sep 17 '22 00:09 mitar

Pinging @elastic/es-search (Team:Search)

elasticsearchmachine avatar Sep 19 '22 22:09 elasticsearchmachine

@mitar could you explain about the benefit of this enhancement? How would it help with your use case?

jtibshirani avatar Sep 19 '22 23:09 jtibshirani

So my use case is that my incoming documents have min_price and max_price fields and I would like to index them to a range field. But currently this does not seem to be possible without modifying the structure of the document before indexing. This is a problem for me because I am using ES both as search engine and data store itself. So I would like to retain the original data structure and be able to index the range field.

mitar avatar Sep 20 '22 07:09 mitar