【发布时间】:2012-02-02 19:52:17
【问题描述】:
我在 Elastic 搜索中找不到查询 Unicode 特殊字符的解决方案。
当我创建这个索引时:
curl -XPUT http://localhost:9200/index/type/1 -d '{"name" : "Vrba u řeky"}'
然后我尝试搜索“řeky”短语,一切正常:
curl -XGET 'http://localhost:9200/index/type/_search?pretty=1' -d '{"query" : {"text" :
{ "_all" : "řeky" }}}'
{
"took" : 1,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 1,
"max_score" : 0.10848885,
"hits" : [ {
"_index" : "index",
"_type" : "type",
"_id" : "1",
"_score" : 0.10848885, "_source" : {"name" : "Vrba u řeky"}
} ]
}
}
但是当我尝试搜索同一个单词时,我什么也没找到:
curl -XGET 'http://localhost:9200/index/type/_search?pretty=1' -d '{"query" : {"text" : { "_all" : "\\u0159eky" }}}'
是否有可能强制弹性接受查询中的转义字符串而不是原始查询?
谢谢。
【问题讨论】:
标签: elasticsearch unicode utf-8