I was wondering whether you can point me at any documentation, or let me know if this is not possible for the following.
I am trying to write a query of a fields called result_code. Some of my documents contain multiple values for result_code
EXAMPLE: result_code: 00, 08, 51
And majority of my other documents result_code only has one value
EXAMPLE: result_code: 00
Is there any way I can filter out (ignore) documents where this field has multiple values. I want to do aggregations on the result_code where is only contains 1 value
Hi Bevano,
You could use a scripted filter aggregation in order to filter only single-value docs for the result_code field in your subsequent aggregations.
example:
Otherwise (less flexible but more efficient at search time), if you don't do arithlmetics on result_code field, map it as type "text" and add a multi-field "lenght" of type "token_count".
Then, index the multiple values as a single concatenated value.
Upon search, you will be able to filter on the numeric field result_code.length=1
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.