I have a field that might take string or numeric value, naturally I would
want to order it numerically if the values turn out to be number.
I tried to map a multi_field with both string and float, but it would not
work if the value is a string. Is there a way to tell elasticsearch to
ignore indexing a sub-field (in this case, the float field) if the format
does not fit?
On the other hand, I know it has been asked before but didn't seem to have
a good answer, is there a better way to sort string value numerically? Is
there roadmap for this feature?
That section is only to tell ES how to order documents when the field is
missing. So if you specify for example:
"sort" : [
{ "price" : {"missing" : "_last"} },
]
If the price field is missing, the document will be pushed to the bottom of
the results. But this still does not help when you define multi-fields with
numeric type and want to store a non-numeric string value.
It sounds fine to me. You don't even need a multi-field if you don't
care about the string value. So for example, you can do something like this:
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.