Moustache search templates are too limited


(Damian Wood) #1

I want to use search templates to generate a query based on the value of a
parameter (not its presence or being True).

For example I have a sortType parameter that can be {nearest, cheapest,
easiest, newest}. Each of these options causes a drastically different
change to the query sent to ES.

I'm assuming that I'm currently limited to creating a boolean flag and
checking for the presence of sortType_nearest, sortType_cheapest etc.

It would be nice to have a template language supported that included an if
statement.

Apologies if this has already been mentioned, but I searched and couldn't
find anything.

--
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/c7ac6071-bd43-4e64-8571-c8036b0d9218%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Mark Walkom) #2

Ok I'll bite, what do you mean by moustache search?

Regards,
Mark Walkom

Infrastructure Engineer
Campaign Monitor
email: markw@campaignmonitor.com
web: www.campaignmonitor.com

On 3 September 2014 07:33, Damian Wood damian.woood9006@gmail.com wrote:

I want to use search templates to generate a query based on the value of a
parameter (not its presence or being True).

For example I have a sortType parameter that can be {nearest, cheapest,
easiest, newest}. Each of these options causes a drastically different
change to the query sent to ES.

I'm assuming that I'm currently limited to creating a boolean flag and
checking for the presence of sortType_nearest, sortType_cheapest etc.

It would be nice to have a template language supported that included an if
statement.

Apologies if this has already been mentioned, but I searched and couldn't
find anything.

--
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/c7ac6071-bd43-4e64-8571-c8036b0d9218%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/c7ac6071-bd43-4e64-8571-c8036b0d9218%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
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/CAEM624a8DxOd%3DoW8NKB7_PuPCm%3D0kzz974AJSiNZf5j3KqhiLA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


(Damian Wood) #3

http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-template.html#_pre_registered_template

On Wednesday, September 3, 2014 10:59:09 AM UTC+1, Mark Walkom wrote:

Ok I'll bite, what do you mean by moustache search?

Regards,
Mark Walkom

Infrastructure Engineer
Campaign Monitor
email: ma...@campaignmonitor.com <javascript:>
web: www.campaignmonitor.com

On 3 September 2014 07:33, Damian Wood <damian.w...@gmail.com
<javascript:>> wrote:

I want to use search templates to generate a query based on the value of
a parameter (not its presence or being True).

For example I have a sortType parameter that can be {nearest, cheapest,
easiest, newest}. Each of these options causes a drastically different
change to the query sent to ES.

I'm assuming that I'm currently limited to creating a boolean flag and
checking for the presence of sortType_nearest, sortType_cheapest etc.

It would be nice to have a template language supported that included an
if statement.

Apologies if this has already been mentioned, but I searched and couldn't
find anything.

--
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 elasticsearc...@googlegroups.com <javascript:>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/c7ac6071-bd43-4e64-8571-c8036b0d9218%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/c7ac6071-bd43-4e64-8571-c8036b0d9218%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
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/5096b6d9-fa58-4e52-9d45-7c7908d1a483%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Damian Wood) #4

Ahh sorry, typo. I meant "mustache".

On Wednesday, September 3, 2014 10:59:09 AM UTC+1, Mark Walkom wrote:

Ok I'll bite, what do you mean by moustache search?

Regards,
Mark Walkom

Infrastructure Engineer
Campaign Monitor
email: ma...@campaignmonitor.com <javascript:>
web: www.campaignmonitor.com

On 3 September 2014 07:33, Damian Wood <damian.w...@gmail.com
<javascript:>> wrote:

I want to use search templates to generate a query based on the value of
a parameter (not its presence or being True).

For example I have a sortType parameter that can be {nearest, cheapest,
easiest, newest}. Each of these options causes a drastically different
change to the query sent to ES.

I'm assuming that I'm currently limited to creating a boolean flag and
checking for the presence of sortType_nearest, sortType_cheapest etc.

It would be nice to have a template language supported that included an
if statement.

Apologies if this has already been mentioned, but I searched and couldn't
find anything.

--
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 elasticsearc...@googlegroups.com <javascript:>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/c7ac6071-bd43-4e64-8571-c8036b0d9218%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/c7ac6071-bd43-4e64-8571-c8036b0d9218%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
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/2c2a9200-35ed-43e3-9fe6-ec880806ddb6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Itamar Syn-Hershko) #5

Templates in general should be logic-less, hence I support the decision of
using mustache. Support of handlebars and maybe also some help from Lucene
expressions may indeed come in handy, but still there may be ways of
achieving what you are after also using mustache

I think this SO answer summarizes all this very well:

--

Itamar Syn-Hershko
http://code972.com | @synhershko https://twitter.com/synhershko
Freelance Developer & Consultant
Author of RavenDB in Action http://manning.com/synhershko/

On Wed, Sep 3, 2014 at 12:33 AM, Damian Wood damian.woood9006@gmail.com
wrote:

I want to use search templates to generate a query based on the value of a
parameter (not its presence or being True).

For example I have a sortType parameter that can be {nearest, cheapest,
easiest, newest}. Each of these options causes a drastically different
change to the query sent to ES.

I'm assuming that I'm currently limited to creating a boolean flag and
checking for the presence of sortType_nearest, sortType_cheapest etc.

It would be nice to have a template language supported that included an if
statement.

Apologies if this has already been mentioned, but I searched and couldn't
find anything.

--
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/c7ac6071-bd43-4e64-8571-c8036b0d9218%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/c7ac6071-bd43-4e64-8571-c8036b0d9218%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
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/CAHTr4Zu0oDyRHke3fF06jNx-syL9SMOjXfCNaTbKNTv%3Dp-Ca8w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


(system) #6