我已经索引了2个对象(ES 1.5)
{
tags: ["tag1","bla-bla"]
}
{
tags: ["tag2"]
}
如果我提出这个要求:
{
"query": {
"filtered": {
"filter": {
"bool": {
"should":
[
{
"term": {
"tags": "bla-bla"
}
}
]
}
}
}
}
}
弹性返回no result,因为tags字段中有**"-"**。
如果我搜索这个,它工作,我有1个结果:
...
"term": {
"tags": "tag1"
}
...
有人能解释一下为什么当我在“标签”字段中放一个破折号(“-”)时,没有结果吗?
1条答案
按热度按时间pdsfdshx1#
如果未指定,则自定义Elasticsearch将使用Standart Analyzer来分析字段。standart analyzer将删除标点符号(在您的情况下为
-
)并将您的术语标记为[tag1
,bla
]。您可以使用term vectors检查分析后的表单: