Still, I think the better approach here would be to use an ingest processor and store the length of the field on indexing (I only tested this on 6.x as well)
Hello Alexander, thanks for checking this, and your detailed reply!
Unfortunately, for ES 5.3.x the doc['_id'] bit already produces the error "Fielddata is not supported on field [_id] of type [_id]", no matter what's written after this. (One more reason to update...)
The idea with storing the length right away is nice. Alas, for checking multiple million documents one would have to "query-by-update" or "_reindex", which both require running a script again once per document, even if it's very simple.
We'll solve the issue by looking at the upstream data from which the _id is generated.
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.