Hi, All who have pondered over this this question, thank you. I have solved this. The above request works. I had an issue because of the way my JSON Object was built. Please note the your JSON Object variable name becomes part of the request.
On Tuesday, April 28, 2015 at 10:05:25 AM UTC+5:30, Nithyanand wrote: > > In another forum, I was given the option of Search templates. But I am > dynamically building boolean "AND" and "OR" query based on name value pairs > which are received as part of the request. In the case of same fields, the > values we use "OR" and between different fields "AND". I have seen search > template, but can we pass a query like this? > > On Monday, April 27, 2015 at 9:20:44 PM UTC+5:30, Nithyanand wrote: >> >> I am using angularjs and elasticsearch.angular.js. I have build a dynamic >> JSON query object based on user requests. Is there a way to in ES >> javascript to pass it to the search api? >> >> In the below example, myJSONQUery is the JSON object. >> >> >> client.search({ >> index: 'myindex*', >> body :{ >> filtered : { >> myJSONQUery >> } >> } >> }).then(function (response) { >> console.info(JSON.stringify(response)); >> }); >> >> -- You received this message because you are subscribed to the Google Groups "elasticsearch" group. To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/feaf4de0-1322-42ca-99e9-8ac079cb6e2e%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.