I have managed to filter them using "more_like_this". But i need to filter them using the Field Name.
Example: Searching value is : 456 and field is:phone_mobile. Scenario: First i Need to check that 'phone_mobile' column is blank or not, if it is not blank, then check whether 'phone_mobile' column has the value '456',if it is true, return the corresponding Data Set.
If it is 'phone_mobile' field is blank, then i need to check 'phone_work' is null or not.if null return empty,otherwise continue the checking.
hope i have explained clearly.
Thanks in Advance for any help
for me, the most easy way to work in php is to first create the query in json, and once this query works in elasticsearch and you get the result that you want, you can traduce this json in array. (to test your json query you can check the plugin head (any request))
That said, I would not use raw JSON outside of prototyping/test. It is not very flexible, and easy to make mistakes. To become more familiar with the array representation, you can json_decode() the raw JSON string into an array, to learn how it transforms:
and to test your json query in your elasticsearch you can download http://mobz.github.io/elasticsearch-head/ and in the tab Any Request you can paste your json and execute.
Hi Camilo_Sierra and polyfractal,
Thanks for your really help full answers.
I have managed to write the search using this array as for the searching json.
oh @DamPe my bad, the filter don't have minimum_number_should_match ! this options is only used in query. you can delete this option and your request will work!
ErrorException in AbstractEndpoint.php line 299:
Invalid argument supplied for foreach()
This file is in here:
at HandleExceptions->handleError('2', 'Invalid argument supplied for foreach()', '/web/api/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/AbstractEndpoint.php', '299', array('params' => null)) in AbstractEndpoint.php line 299
it is probable that the problem come to your php code when you use the client search, to be sure that it's not the query the problem use a simple query that you already know that it works and replace it in your code!
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.