I am working in ASP.NET MVC5 C# using Nest library.
I have some important columns with text/string type and have to apply in clause/query on it and also need to apply sort based on them.
I am using below terms query and it is returning 0 results:
var searchResponse = ElasticClientContext.Search(s => s> .From(0)
.Query(q => q.Terms(t => t.Field(f => f.DepartmentName).Terms(deptNames))));
Sorting is returning below message:
Fielddata is disabled on text fields by default. Set fielddata=true on [depatrmentName] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory. Alternatively use a keyword field instead.
Please help. .. are both issues related .. do I need to set fielddata=true to apply terms query on this column .. why text type fields are not mapped and how to set fielddata=true at the time of index creation or put mapping.
Thanks in advance.