Could someone tell us how to define an analyzer using the NEST syntax for the following: Language Spanish requiring a Standard Analyzer with Spanish stop words and Spanish stemmer.
We have looked at the docs but apart from English analyzers, nothing else is understandable. Many thanks.
Default Spanish analyzer is already configured in the way you described. Remaining thing is to tell elasticsearch to use it. Fortunately NEST folks prepared a very detailed and comprehensive doc about index mapping configuration. You can found it here.
For instance, you could use fluent mappping like follow to configure your field with Spanish analyzer
await client.Indices.CreateAsync("my_index", i => i
.Map<Document>(m => m
.Properties(p => p
.Text(t => t.Name(n => n.Title).Analyzer("spanish")))));
public class Document
{
public int Id { get; set; }
public string Title { get; set; }
}
Above, will create an index with the following mapping
{
"my_index":{
"mappings":{
"properties":{
"title":{
"type":"text",
"analyzer":"spanish"
}
}
}
}
}
Hope that helps.