I'm new to ElasticSearch and I'm using NEST to run my queries. I need to be able to add X amount of filtering terms to my query.
For now my query looks like this:
var page = new Page
{
Id = 1,
Name = "JR-11 Hyper black"
};
var tags = new Dictionary<string, string[]>
{
{ "Size", new[] { "16", "17", "18" }},
{ "Color", new[] { "Bronze", "Hyper Black", "Flat Black" }}
};
page.Tags = tags;
ElasticClient.Index(page, idx => idx.Index("pages"));
var result = ElasticClient.Search<Page>(
body => body.Query(query => query.ConstantScore(
csq => csq.Filter(filter => filter.Term("tags.Size", "17" ))))
.Take(1000));
var pages = result.Documents.ToList();
The problem I have is with the csq.Filter(filer => filter.Term("tags.Storlek")
I need to be able to add a dynamic amount of such filters. Can't really find anything in the documentation for the 2.3 version that I'm using.