我有以下elasticsearch映射
{
"mappings": {
"hotel": {
'properties': {"name": {
"type": "string",
"search_analyzer": "str_search_analyzer",
"index_analyzer": "str_index_analyzer"},
"destination": {'properties': {'en': {
"type": "string",
"search_analyzer": "str_search_analyzer",
"index_analyzer": "str_index_analyzer"}}},
"country": {"properties": {"en": {
"type": "string",
"search_analyzer": "str_search_analyzer",
"index_analyzer": "str_index_analyzer"}}},
"destination_facets": {"properties": {"en": {
"type": "string",
"search_analyzer": "facet_analyzer"
}}}
}
}
},
"settings": {
"analysis": {
"analyzer": {
"str_search_analyzer": {
"tokenizer": "keyword",
"filter": ["lowercase"]
},
"str_index_analyzer": {
"tokenizer": "keyword",
"filter": ["lowercase", "substring"]
},
"facet_analyzer": {
"type": "keyword",
"tokenizer": "keyword"
},
},
"filter": {
"substring": {
"type": "edgeNGram",
"min_gram": 1,
"max_gram": 20,
}
}
}
}
}我希望我的destination_facets不会被标记化。但它是以空白标记的形式出现的。有没有一种方法可以忽略所有令牌活动?
发布于 2013-05-30 22:50:32
您可能不仅需要为search_analyzer设置facet_analyzer,而且还需要为index_analyzer设置您的search_analyzer (Elasticsearch可能会将此use用于分面,而search_analyzer仅用于解析查询字符串)。
请注意,如果您希望两者使用相同的analyze,则只需在映射中使用名称analyzer。
例如:
{
"mappings": {
"hotel": {
...
"destination_facets": {"properties": {"en": {
"type": "string",
"analyzer": "facet_analyzer"
}}}
}
}
},
"settings": {
...
}}
https://stackoverflow.com/questions/16839157
复制相似问题