通配符和定期搜索根据情况返回不同的结果
我正在使用Docker Image使用OpenSearch版本1.3.1。
这是我的索引和一个文档:
PUT index_0
{
"settings":{
"analysis":{
"analyzer":{
"keyword_lower":{
"type":"custom",
"tokenizer":"keyword",
"filter":"lowercase"
}
}
}
},
"mappings":{
"properties":{
"id":{
"type":"text",
"index":true
},
"name":{
"type":"text",
"index":true,
"analyzer":"keyword_lower"
}
}
}
}
PUT index_0/_doc/1
{
"id":"123",
"name":"FooBar"
}
如果我运行此查询,我会得到结果(请注意,请注意较小的b):
GET index_0/_search?pretty
{"query":{"wildcard":{"name":"Foobar"}}}
但是,如果我运行此查询,则不会:
GET index_0/_search?pretty
{"query":{"term":{"name":"Foobar"}}}
为什么A term term
为什么搜索似乎是案例敏感的,而Wildcard
却不是相同的字段?
I am using OpenSearch version 1.3.1 via the Docker image.
Here is my index and a document:
PUT index_0
{
"settings":{
"analysis":{
"analyzer":{
"keyword_lower":{
"type":"custom",
"tokenizer":"keyword",
"filter":"lowercase"
}
}
}
},
"mappings":{
"properties":{
"id":{
"type":"text",
"index":true
},
"name":{
"type":"text",
"index":true,
"analyzer":"keyword_lower"
}
}
}
}
PUT index_0/_doc/1
{
"id":"123",
"name":"FooBar"
}
If I run this query, I get results (notice the difference in case, lowercase b):
GET index_0/_search?pretty
{"query":{"wildcard":{"name":"Foobar"}}}
But if I run this query, I do not:
GET index_0/_search?pretty
{"query":{"term":{"name":"Foobar"}}}
Why does a term
search seem to be case sensitive whereas a wildcard
one is not, given the same field?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论