When I run the template, it simply retrieves the first 10 documents and does not perform any aggregations.
Whereas when I run the same query without using the template it works fine.
Am I missing something with the templates here?
I have run other simpler templates which work fine for me.
Hi,
doesn't seem like the reason could be POST vs GET, how did you get to this conclusion? That said I am not sure yet what goes wrong with your request, nothing I can see at first glance.
Thanks @javanna
Regarding POST vs GET:
I am not entirely sure why but, as we know there are some searches that work with only POST and others with GET.
The above query when I run with GET it get error. And with POST I get the correct result.
But whereas when I use template to run the same query, I get error with POST, and GET does not give correct result. [Actually returns records without any aggregations]
So I wonder, how the query template is executed at the back end to handle POST and GET based queries.
Sorry @javanna , I do not get error with GET. The query returns the documents but not aggregated results. Similar to the result when I use GET with template.
I get the following error with POST using the template:
I don't really have a good solution for you, this is more like a "me too" type of reply.
Anyway I also ran into this issue a while ago and I just couldn't get the template to work. It seemed that the mustache template parser always inserts those quotes. My issue was with document ids. When I tried to make a query that searched for something based on a list of ids I couldn't get it to work. A single id worked just fine, but when I tried to specify a list of anything I always got the quotes. I noticed that the same template works if I put it in a file in the scripts folder in the node. I lived with that for a while, but eventually I got frustrated with how awkward it is to maintain the template files and I got rid of them. So now I have given up on templates and I simply have my own templating system based on constant strings that I fill with required details. It's far from ideal but what can you do...
So the template thing would be great if it worked, but as it stands it seems broken.
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.