I\'m trying to index a pdf document with elasticsearch/NEST.
The file is indexed but search results returns with 0 hits.
I need the search result to return o
// I am using FSRiver plugin - https://github.com/dadoonet/fsriver/
void Main()
{
// search in document
string query = "directly"; // test.pdf contains the string "directly"
var es = new ElasticClient(new ConnectionSettings( new Uri("http://*.*.*.*:9200"))
.SetDefaultIndex("mydocs")
.MapDefaultTypeNames(s=>s.Add(typeof(Doc), "doc")));
var result = es.Search(s => s
.Fields(f => f.Title, f => f.Name)
.From(0)
.Size(10000)
.Query(q => q.QueryString(qs => qs.Query(query)))
.Highlight(h => h
.PreTags("")
.PostTags("")
.OnFields(
f => f
.OnField(e => e.File)
.PreTags("")
.PostTags("")
)
)
);
}
[ElasticType(Name = "doc", SearchAnalyzer = "standard", IndexAnalyzer = "standard")]
public class Doc
{
public int Id { get; set; }
[ElasticProperty(Store = true)]
public string Title { get; set; }
[ElasticProperty(Type = FieldType.attachment, TermVector = TermVectorOption.with_positions_offsets)]
public string File { get; set; }
public string Name { get; set; }
}