Hi, can someone help me write the correct query if possible? I want to return documents with field A gt 10 AND field B gt 10. The below query only returns documents with filed A gt 10 and field B (but B is not gt 10). Please help!
What is the mappings of the fields you are applying the range clauses to? If they are mapped as text/keyword the range will be based on string comparison (where "5.0" > "10.0") and not numeric comparison.
Thanks for your reply. They are mapped as text. However, the "characteristics.range" results are > 10, and the characteristics.length results are < 10. In your example string comparison, why is "5.0" >"10.0" ? Just curious as to why this is?
When you compare strings you compare one character at a time from the start based on the ASCII value, so since '5' > '1' you get different results compared to numeric comparison.
If you want numeric comparison you need to map the field as a numeric type.
Ah, ok. Any suggestions on how to achieve what I want? Unfortunately I can't change the mappings. I've had success with regex using e.g.<5-100> but that does not work with values containing decimal points.
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.