THANKS!
After a few days I found out what I was doing wrong and it was all about the mapping.
Here are the steps I took to approach the problem and solve it in the end
1 - first of all I`ve opened kibana console and found out that only the last field of my mapped fields was being assigned to my custom analyser (folding-analyser)
To test each one of your fields you can use the GET FIELD MAPPING API and a command in dev tools like this:
GET /<index>/_mapping/field/<field>
then you'll be able to see if your analyser is being assigned to your field or not
2 - After that, I discovered that the last field was the only one being assigned to my custom analyser and the reason was because I was messing up with fluent mapping in two ways:
- First of all, I had to chain my text properties correctly
- Second of all, I was trying to map another POCO class in another Map<> clause, when I was supposed to use the Object<> clause
the correct mapping that worked for me was a bit like this:
.Map<Noticia>(mm => mm
.AutoMap()
.Properties(p => p
.Text(t => t
.Name(n => n.Field1)
.Analyzer("folding-analyzer")
)
.Text(t => t
.Name(n => n.Field2)
.Analyzer("folding-analyzer")
)
.Object<NoticiaArquivo>(o => o
.Name(n => n.Arquivos)
.Properties(eps => eps
.Text(s => s
.Name(e => e.NAField1)
.Analyzer("folding-analyzer")
)
.Text(s => s
.Name(e => e.NAField2)
.Analyzer("folding-analyzer")
)
)
)
)
)
Finally, It's important to share that when you assign an analyser using the .Analyzer("analiserName") clause, you're telling elastic search that you want to use the argument analyser both for indexing and search
If you want to use an analyser only when you search and not on indexing time, you should use the .SearchAnalyzer("analiserName") clause.