I've noticed that if I define a field as type integer I'm allowed to insert values as either strings-of-integers or integers. And when I pull these values back out, they come back in the same form.
I'd like my integers to all be saved as integers, converting as necessary. Is this possible? Am I misunderstanding numeric field types?
For filtering and querying, the integer and string-of-integer values act the same. (good!)
They are not the same for json output. (maybe bad!)
They are not the same in groovy. (e.g. .contains()) (bad!)
In my application, I have a groovy script to do conditional inserts and removals into an array of values in a document, short-circuiting to a no-op (ctx.op="none") if the value is (not) already present -- treating an array of label_ids as a set. This logic gets broken if given a mix of integers and strings-of-integers.
coerce (default=true) allows quoted numbers to be coerced into numeric fields. But for some reason, ES remembers the original form of string vs numeric, and returns values in their original form.
with coerce=false, the strings would be rejected as invalid.
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.