Search by Numbers
Making search queries in instances of fields containing numbers is very similar to searching for fields of type field:word
. The main difference is that, when searching for a range numbers you can use the following operators:
operator | meaning | syntax | example |
---|---|---|---|
> | higher than | value:>50 | try |
>= | higher than or equal to | value:>=50 | try |
< | lower than | value:<50 | try |
<= | lower than or equal to | value:<=50 | try |
When you want to search for records where the value of a field is equal to a given number you just enter the name of the field followed by the value as in field:value
or, as in our example, value:50
.
The video included below shows how to do search queries in numerical fields with the help of the above mentioned operators:
If you want to search records fields where the value of a feld is within a range of numbers, there is also a much more easier alternative than using structured search or inserting the term AND
between two numerical expressions as in (value:>50 AND value :<100000)
- try it here. Indeed, ElasticSearch - the search engine adopted in the CoB platform - also supports a specific, more manageable, syntax suited to use cases involving a range of numbers. Thus, we could write a search query for the same range of numbers - all values higher than 50 and lower than 100 000 - in the following way:
value:[50 TO 100000]
- example.
The expression is very easy to understand: name_of_the_field:[start number TO end number]
.
If you don't want either the start number or the end number or even both of them to show up in the search results, you can replace [
or/and ]
by {
or/and }
. For instance, staying with our example, if we didn't want the value 50 to appear in search results but still wanted to search for all numbers between 51 and 100 000, we would change the expression to:
value:{50 TO 100000]
- example.
The same would apply to 100 000:
value:[50 TO 1000000}
- example.
In case you don't want to use a specic start number or end number, you can replace with an asterisk - *
-:
Here is a video of how it works out in practice: