How to filter a field with entries of different version number formats in Elasticsearch documents

Hello, everyone,

how to filter and sort a field with entries of different version numbers in Elasticsearch documents?
For example different documents contain the field version with entries like "10.0", "10.1.5", "9" or "23.932.01".

How can a "greater than" search be done by entering a version number. By default Elasticsearch saves the data as string. Simple conversion to a number is not possible due to the different formats.
Is there a similar data structure as the data type ip to represent version numbers?

Always happy to hear from the community


May be you can use pipeline with a script processor in order to build a new string field with



Hi Dominique,

thanks for your answer. Unfortunately I didn't find a way to narrow down the search in Elasticsearch by using the DSL syntax and a range filter. (The Range filter does not work with string fields.)

Or do you think I should use the datatype ip here? Unfortunately I am limited in the formatting of the version numbers again.

kind regards


A data can be indexed in several ways at the same time by using copy_to and appropriate data type and analyse. For instance as a string for sorting and filtering and as text in order to tokenized. You can also imagine split the field in 4 distinct numeric or keyword fields.


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