I have a need for doing a timelion count of a certain field (myField)... but only if another field (errorField) is not 0.
So I made a scripted field: myFieldIfNoError
if (doc['errorField'].value != null && doc['errorField'].value != 0){ return doc['myField'].value; } return null.
I would have the scripted field return either 0 and 1 and then instead of doing a count, do a sum() on that field. That will give you the count, and omit the documents with the 0-value.
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.