I would like to do a popcount over a long field inside of a painless script, but I do not understand the documentation here. There is no single example in how to access native java functions inside of painless.
(You also had a typo.)
This also works although I think I never saw an example doing it like that:
return java.lang.Long.bitCount(31416);
Imagine the package is imported:
import java.lang.*;
Apply this to all available packages in the context in which your are.
There are example in the docs but I'm not saying that because I disagree with your documentation improvement suggestion. I'm not a born developer and I'm intimidated by painless myself and it's kinda required to do alarming with the Watcher feature.
See the example on this page for an example of an example :
Not directly related but sites like this one (first link out of googling "java Long.bitCount example") help me sometimes because as I said not a formally trained developer:
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.