Вопрос

As described in the _all field Elasticsearch Documentation.

The _all fields allows for store, term_vector and analyzer (with specific index_analyzer and search_analyzer) to be set.

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"
        }

       ...
  }

I did not see anything that would allow for this in the Fluent Mappings. Can I set this manually if not via Fluent Mapping?

Это было полезно?

Решение

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)
    )
    ...
    ...
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top