传递整数数组ElasticSeach模板 [英] Pass an array of integers to ElasticSeach template

查看:199
本文介绍了传递整数数组ElasticSeach模板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用下面的胡子模板传递整数数组ElasticSearch模板。

I am trying to pass an array of integers to ElasticSearch template using the below mustache template.

{{#filter5_terms}} 
"terms": {
"{{filter5_name}}": [
"{{#filter5_lt}}", 
"{{.}}",                                
"{{/filter5_lt}}"  ]
}
{{/filter5_terms}}

以上的作品,如果我通过一个字符串数组(例:A,B]但同样是与int数组[1,2]使用嵌套失败:NumberFormatException异常[对于输入字符串: ];误差

Above works, If I pass a string array (Ex: ["A","B"]. But the same is failing with the int array [1,2] with Nested: NumberFormatException[For input string: ""]; error.

参考:<一href=\"http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-template.html#_passing_an_array_of_strings\" rel=\"nofollow\">http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-template.html#_passing_an_array_of_strings

能否请您让我知道如果我缺少什么吗?

Can you please let me know if I am missing anything?

谢谢
阿尼尔

推荐答案

我没有解决这个问题。
我们可以用下面来替换整数数组ElasticSearch查询。

I did fix this. We can use the below to replace the integer array into ElasticSearch query.

"terms": {
"{{filter5_name}}": {{filter5_lt}}
}

ElasticSearch文档有一个例子来替换字符串数组,我试图使用相同的整数数组和它没有工作。

ElasticSearch documentation has an example to replace string arrays and I tried to use the same for integer arrays and it did not work.

所以我不得不使用它在胡子模板实例提供以上。

So I had to use the above which is provided in Mustache templating examples.

谢谢
阿尼尔

这篇关于传递整数数组ElasticSeach模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆