Elasticsearch template not reading params -


i've been following example @ site parameterizing queries in solr , elasticsearch in es section. note, older es version author working with, don't think should affect situation. using version 1.6 of es.

i have template {{es_home}}/config/scripts/test.mustache looks below snippet. note {{q}} parameter in "query".

{    "query": {     "multi_match": {       "query": "{{q}}",       "analyzer": "keyword",       "fields": [           "description^10",           "name^50",       ]     }   },   "aggregations": {     "doctype" : {       "terms" : {          "field" : "doctype.untouched"             }     }   } } 

i post http://localhost:9200/forward/_search/template following message body

{   "template": {     "file": "test",     "params": {       "q": "a"     }   } } 

it runs template, gets 0 hits, , returns following:

{     "took": 3,     "timed_out": false,     "_shards": {         "total": 5,         "successful": 5,         "failed": 0     },     "hits": {         "total": 0,         "max_score": null,         "hits": []     },     "aggregations": {         "doctype": {             "doc_count_error_upper_bound": 0,             "sum_other_doc_count": 0,             "buckets": []         },     } } 

alternatively, if hard code "a" {{q}} is, , post template, correctly returns results query "a". doing inherently wrong in design?

according docs, params object should outside of template object

{     "template": {         "file": "test"     },     "params": {         "q": "a"     } }  

Comments

Popular posts from this blog

python - Healpy: From Data to Healpix map -

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -