Hi,
Can anyone tell me what this means?
[ElasticProperty(Index = FieldIndexOption.Analyzed)]
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
I've been looking through documentation and I just don't understand what it means.
I asked that bc I've been trying to add a filter to a search and on every property that has one the above annotations, the result is always empty even though it should not be(to my understanding).
I am attempting to perform a query with filters. I can get it to filter on some properties but not the one I need. Here is my model:
public class IndexItem
{
public DateTime CreatedDate { get; set; }
[ElasticProperty(Index = FieldIndexOption.Analyzed)]
public String Name { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public String Role { get; set; }
public bool ExcludeFromSearch { get; set; }
}
If I filter on CreatedDate or ExcludeFromSearch it works like I would think, But I cannot get it to work for Role.
filter.Add(Filter.Term(x => x.CreatedDate, searchDate)); // Works
filter.Add(Filter.Term(x => x.Role, role)); // Never Returns a result
var searchResults = client.Search<IndexItem>(s => s
.Types(typeof(IndexItem))
.From(start)
.Size(count)
.Query(esQuery)
.Filter(x => x.And(filter.ToArray()))
); // Returns empty if I filter by Role, but works if i filter by CreatedDate
The only difference I can see is that Role has the annotation [ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]. Does this make it not allowed to be filtered by?
Thanks for all the help and tips