我需要找到一种方法来查询 Elastic search 中的 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" }}}'
是否有办法强制Elastic接受转义字符串作为查询而不是原始查询?
谢谢。