Object interpolation in template queries


(Alex G) #1

Hello,

I'm interested in using query templates -
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-template-query.html

  • however for my purposes I was hoping ES treaded queries as simple strings
    for the purpose of mustache interpretation and I would to be able to
    substitute in parameters more complex than partial strings - for example to
    define a param as the contents of a value and then pass in an arbitrary
    object.

IE something along the lines of
{
"query": {
"template": {
"query": {
"filtered": {
"filter" : {
"and" : {{ filters }}
}
}
},
"params" : {
"filters" : [
{"terms" : { "foo" : ["a","b" ] } },
{"terms" : { "bar" : ["q","z" ] } }
]
}
}
}
}

Experimentation suggests this isn't supported but I understand that the
query templates system is somewhat under construction or review - are there
plans to offer support for passing in entire parts of queries via params or
should I look at doing this kind of interpolation before the query gets to
ES? Or is this possible and I'm simply doing it wrong?

Thanks,
Alex

--


CONFIDENTIALITY NOTICE: The information contained in this message may be privileged and/or confidential. It is the property of CrowdStrike. If you are not the intended recipient, or responsible for delivering this message to the intended recipient, any review, forwarding, dissemination, distribution or copying of this communication or any attachment(s) is strictly prohibited. If you have received this message in error, please notify the sender immediately, and delete it and all attachments from your computer and network.

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/8b83afe9-aa92-4751-8178-2c33bbc94428%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(system) #2