Expression sources are the source of the data being aggregated in analytics expressions.
These sources can be either Solr fields indexed with docValues, or constants.
Supported Field Types
The following Solr field types are supported. Fields of these types can be either multi-valued and single-valued.
All fields used in analytics expressions must have docValues enabled.
String |
StrField |
Boolean |
BoolField |
Integer |
TrieIntField |
Long |
TrieLongField |
Float |
TrieFloatField |
Double |
TrieDoubleField |
Date |
TrieDateField |
Multi-valued Field De-duplication
All multi-valued field types, except for PointFields, are de-duplicated, meaning duplicate values for the same field are removed during indexing. In order to save duplicates, you must use PointField types. |
Constants
Constants can be included in expressions to use along side fields and functions. The available constants are shown below. Constants do not need to be surrounded by any function to define them, they can be used exactly like fields in an expression.
Strings
There are two possible ways of specifying constant strings, as shown below.
-
Surrounded by double quotes, inside the quotes both
"
and\
must be escaped with a\
character."Inside of 'double' \\ \"quotes\""
=>Inside of 'double' \ "quotes"
-
Surrounded by single quotes, inside the quotes both
'
and\
must be escaped with a\
character.'Inside of "single" \\ \'quotes\''
=>Inside of "double" \ 'quotes'
Dates
Dates can be specified in the same way as they are in Solr queries. Just use ISO-8601 format. For more information, refer to the Working with Dates section.
-
2017-07-17T19:35:08Z
Numeric
Any non-decimal number will be read as an integer, or as a long if it is too large for an integer. All decimal numbers will be read as doubles.
-
-123421
: Integer -
800000000000
: Long -
230.34
: Double
We welcome feedback on Solr documentation. However, we cannot provide application support via comments. If you need help, please send a message to the Solr User mailing list.