0

我正在尝试对索引中的某些关键字运行聚合,但我想在索引和搜索时将所有关键字小写,但弹性 5.1 不支持规范化器。另外,我不想将它们索引为文本并启用字段数据。有什么其他选择可以实现这一目标?

4

1 回答 1

0

您可以使用由标记器keywordlowercase标记过滤器组成的分析器。

PUT my_index
{
  "settings": {
    "analysis": {
      "analyzer": {
        "my_keyword": { 
          "type":      "custom",
          "tokenizer": "keyword",
          "filter": ["lowercase"]
        }
      }
    }
  },
  "mappings": {
    "my_type": {
      "properties": {
        "my_field": {
          "type":     "text",
          "analyzer": "standard", 
          "fields": {
            "keyword": {
              "type":     "text",
              "analyzer": "my_keyword" 
            }
          }
        }
      }
    }
  }
}
于 2017-04-14T15:48:48.067 回答