c# - Nest and Elastic Search - Mapping -
i trying map multiple analyzers field in elastic type. if use elasticattribute map analyzer:
[elasticproperty(analyzer = "fulltext")] public string longdescription { get; set; }
and @ request created get:
"name": { "type": "string", "analyzer": "fulltext" },
in order map multiple analyzers same field, use fluent mapping , add multifield:
.properties(prop => prop .multifield(mf => mf .name(p => p.name) .fields(f => f .string( s => s.name(n => n.name) .indexanalyzer("autocomplete_analyzer") .includeinall(false) .index(fieldindexoption.not_analyzed)) .string( s => s.name(n => n.name) .indexanalyzer("fulltext") .includeinall(false) .index(fieldindexoption.not_analyzed)) ) ) )
the request generated looks this:
"name": { "type": "multi_field", "fields": { "name": { "type": "string", "index": "not_analyzed", "index_analyzer": "autocomplete_analyzer", "include_in_all": false }, "name": { "type": "string", "index": "not_analyzed", "index_analyzer": "fulltext", "include_in_all": false } } },
i interested in "analyzer"/"index_analyzer" properties. fluent mapping, can set indexanalyzer or searchanalyzer. understand difference between indexanalyzer , searchanalyzer, "analyzer" property when use elasticattribute? mean index , search set same?
just specifying analyzer
indeed setting index_analyzer
, search_analyzer
@ same time. analyzer
elasticsearch property , not magic behavior nest.
the fluent mapping missing .analyzer()
method, added in 1.0!
Comments
Post a Comment