Elasticsearch-选择要用于字段的分析器 [英] Elasticsearch - Choosing the analyzer to use for fields
问题描述
如何告诉 query_string
在搜索中使用哪个分析器?
How do I tell query_string
which analyzer to use in a search?
我已经使用分析器创建了索引,如下所示:
I've created my index with an analyzer like so:
"analysis": {
"analyzer": {
"std_analyzer": {
"tokenizer": "whitespace",
"filter": [ "stemmer" ]
}
}
}
我没有预定义任何映射.相反,我依赖在插入文档时动态添加映射.
I do not predefine any mappings. Instead, I rely mappings to be dynamically added upon inserting a document.
调用/my_index/_mapping
"short_bio" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
动态添加字段时,您将在映射中看到没有定义的分析器.
You will see there no analyzer defined in the mapping when the field is added dynamically.
这是否意味着搜索将自动使用通过索引( std_analyzer
)创建的分析器?还是使用其他分析仪?如何强制它使用我想要的分析仪?
Does this mean searching will automatically use the analyzer that was created with the index (std_analyzer
)? Or is some other analyzer used? How do I force it to use the analyzer that I want?
如果相关,我正在使用 query_string
进行搜索以利用AND/OR/NOT/grouping
If's relevant, I'm searching using query_string
to take advantage of AND/OR/NOT/grouping
谢谢!