I started recently using Elastic Search, with its .net client NEST. A lot of questions to ask.
I'm currently blocked while trying to highlight search results in attachment field, with elasticsearch-mapper-attachments plugin. The indexation works well, the mapping seems correct, the encode and decode work well too,
Once I tried to search by keyword, ES seems to be able to find the right documents which contain the keyword, but in the highlight result, instead of showing the decoded text, it shows nothing, or the encoded one.
Read from another post treating some same features, the solution is to set store = yes, and TermVector = TermVectorOption.WithPositionsOffsets.
So I tried to configure it in my C# class file with
[ElasticProperty(Name = "attach", Type = FieldType.Attachment, Store=true, TermVector = TermVectorOption.WithPositionsOffsets)]
public string attach { get; set; }
and the query is the follwing (however no highlight result is given back)
{
"fields" : ["name","attach"],
"query" : {
"query_string" : {
"query" : "settings"
}
},
"highlight" : {
"fields" : {
"attach" : {}
}
}
}
Seems while creating mapping for a type from a class, the attachment attribute was not set correctly : since while checking with localhost:9200/myindex/mytype/_mapping?pretty the attachment attribute has no Store=true, TermVector = TermVectorOption.WithPositionsOffsets for it.
Do you have some idea please? Thanks