String lexicographic range query in Elasticsearch String lexicographic range query in Elasticsearch elasticsearch elasticsearch

String lexicographic range query in Elasticsearch


Yes, it is possible. The RangeQuery provided by the elasticsearch query DSL internally uses the lucene TermRangeQuery for field of type string. On the other hand, it uses the lucene NumericRangeQuery for field of type number/date.


By default ElasticSearch keeps all indexed data lowercase. It does not lowercase the queries, though. Great.

To wrap up: after sending the queries (from and to values) all in lowercase the range searching works like a charm.