【发布时间】:2015-07-22 10:27:04
【问题描述】:
首先,我对 ES 完全陌生。我在下面创建了 ES 搜索条件来搜索可以正常工作的项目,但我现在需要的是,我想将 make 字段变为不区分大小写,以便hello 的搜索结果相同, HeLlo、HELLO 等等。
由于我的知识非常有限,我已阅读下面的帖子无法安静地适用于下面的示例:
- Case insensitivity does not work
- Elasticsearch Map case insensitive to not_analyzed documents
- Elasticsearch Snowball Analyzer wants exact word
从 make 中删除 not_analyzed 没有帮助。
'indexes' => [
'my_project' => [
'client' => 'default',
'index_name' => 'hello',
'settings' => [
'index' => [
'analysis' => [
'analyzer' => [
'snowball_analyzer' => [
'type' => 'snowball',
'language' => 'English',
],
],
],
],
],
'types' => [
'item' => [
'mappings' => [
'uuid' => ['type' => 'string', 'index' => 'not_analyzed'],
'name' => ['type' => 'string', 'boost' => 8, 'analyzer' => 'snowball_analyzer'],
'make' => ['type' => 'string', 'index' => 'not_analyzed'],
]
],
],
],
],
这些是我创建的查询:
1
{
"query": {
"filtered": {
"query": {
"bool": {
"must": [
{
"term": {
"make": "HeLlo"
}
}
]
}
}
}
}
}
【问题讨论】:
-
帖子中没有搜索条件。搜索不区分大小写与映射和/或搜索本身有关。
标签: php symfony elasticsearch foselasticabundle