我想配置一个属性,以便ES根据我的需要对其进行索引我喜欢" CDE-250"可以找到" CDE"," cde"," cde - "或" CDE - " 搜索不应区分大小写,并且" - "人物应该被索引/分析 我当时想这样做
@Field(type = FieldType.String, indexAnalyzer = "whitespace", searchAnalyzer="whitespace" )
private String model;
感谢您的帮助
[更新] 我在src / main / elasticsearch / oss-search.json中添加了这个文件oss-search.json
{
"settings": {
"number_of_shards": 1,
"analysis": {
"filter": {
"oss_filter": {
"type": "edge_ngram",
"min_gram": 1,
"max_gram": 20
}
},
"analyzer": {
"oss": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"lowercase",
"oss_filter"
]
}
}
}
}
}
这是我要为弹性搜索配置的课程
@Document(indexName = "device")
@Setting(settingPath = "/elasticsearch/oss-search.json")
public class Device implements Serializable {
@Field(type = FieldType.String, indexAnalyzer = "oss")
private String model;
}
但我有以下错误
2016-11-17 16:31:13.821 ERROR 15892 --- [ main] .d.e.r.s.AbstractElasticsearchRepository : failed to load elasticsearch nodes : org.elasticsearch.index.mapper.MapperParsingException: Analyzer [oss] not found for field [model]