_all字段允许设置存储,term_vector和分析器(具有特定的index_analyzer和search_analyzer).
The _all fields allows for store, term_vector and analyzer (with specific index_analyzer and search_analyzer) to be set.
是否可以在_all
字段上为使用NEST的映射指定index_analyzer
和search_analyzer
属性?具体来说,我希望能够为索引设置以下内容:
Is there a way to specify the index_analyzer
and search_analyzer
attributes on the _all
field for a mapping with NEST? Specifically, I would like to be able to set the following for my index:
{
"model": {
"_all": {
"index_analyzer": "nGram_analyzer",
"search_analyzer": "whitespace_analyzer"
}
...
}
在Fluent Mapping中,我看不到任何可以做到这一点的东西.如果不通过Fluent Mapping可以手动设置吗?
I did not see anything that would allow for this in the Fluent Mappings. Can I set this manually if not via Fluent Mapping?
推荐答案
从NEST 1.0开始,您现在可以执行以下操作:
Starting from NEST 1.0 you can now do this:
var result = this._client.Map<ElasticsearchProject>(m => m
.AllField(a=>a
.Enabled()
.IndexAnalyzer("nGram_analyzer")
.SearchAnalyzer("whitespace_analyzer")
.TermVector(TermVectorOption.with_positions_offsets)
)
...
...
这篇关于使用NEST为_all字段设置分析器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!