Java-API: search template: passing an array as parameter

Hi,

I'm trying to use the java-api to pass an array of parameters to a search
template. Since the SearchRequestBuilder.setTemplateParams only allows am Map<String,
String> as parameter I'm stuck. Any ideas are wellcomed. I'm using
Elasticsearch 1.4.0

Search Template created via sense:
GET /_search/template/test
{
"template": {
"query": {
"terms": {
"searchterm": [
"{{#searchterm}}",
"{{.}}",
"{{/searchterm}}"
]
}
}
}
}

Calling the search template via REST works fine:
GET /myindex/_search/template
{
"template": {
"id" : "test"
},
"params" : {
"searchterm" : [
"term1",
"term2"
]
}
}

--
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/27cafc64-d21b-4fec-8273-3f92ef92ad8f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

This has been fixed in elasticsearch 1.5 (branch 1.x): Make template params take arrays by reuben-sutton · Pull Request #8255 · elastic/elasticsearch · GitHub https://github.com/elasticsearch/elasticsearch/pull/8255

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet https://twitter.com/dadoonet | @elasticsearchfr https://twitter.com/elasticsearchfr | @scrutmydocs https://twitter.com/scrutmydocs

Le 2 déc. 2014 à 13:20, janne.olesen@oberbaum-concept.com a écrit :

Hi,

I'm trying to use the java-api to pass an array of parameters to a search template. Since the SearchRequestBuilder.setTemplateParams only allows am Map<String, String> as parameter I'm stuck. Any ideas are wellcomed. I'm using Elasticsearch 1.4.0

Search Template created via sense:
GET /_search/template/test
{
"template": {
"query": {
"terms": {
"searchterm": [
"{{#searchterm}}",
"{{.}}",
"{{/searchterm}}"
]
}
}
}
}

Calling the search template via REST works fine:
GET /myindex/_search/template
{
"template": {
"id" : "test"
},
"params" : {
"searchterm" : [
"term1",
"term2"
]
}
}

--
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 mailto:elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/27cafc64-d21b-4fec-8273-3f92ef92ad8f%40googlegroups.com https://groups.google.com/d/msgid/elasticsearch/27cafc64-d21b-4fec-8273-3f92ef92ad8f%40googlegroups.com?utm_medium=email&utm_source=footer.
For more options, visit https://groups.google.com/d/optout 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/354A25B5-81E9-4784-8BE8-4A0113421D25%40pilato.fr.
For more options, visit https://groups.google.com/d/optout.