i will tried to explain with sql terms, maybe it will be easy to understand!
we have a should because it can be p_mobile or p_home (sql OR) but inside the "should" query for one condition we will add a must (is inside OR query add AND options) bool allow us to encapsulate the exist filter and the term filter.
the first query that i send you is the literally traduction of :
the exist check if the field is empty or not and the terms if the value correspond.
but we can do easier, in the last query we forget php and think in elasticsearch mode, we like to get all the documents that had p_mobile or p_home with a value of 465, so we don't need to know if exist or not because the only think that is important is that my fields correspond to my value 465.
normaly if your mapping is defined as a integer you dont need to use the " " ! check the type for phone_home, and phone_mobile and is not at integer defined in your template or mapping file and reindex
Please help me. I am using php 5.5 and Elasticsearch 2.1. I want to do ranking among history. But my date filter does not work correctly.
I am getting accurate results when I made query only between the dates.However, I am not getting accurate results when I made query with date mont, day and hour.
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.