I'd like to name my queries that I send to my elastic search instance (version 2.3) so i can see the name in my log file. I use a .net application which uses NEST.2.1.1 to interact with the elastic search index. According to the ES documentation I should be able to use _name to give a name to my query but there's no method called that available, there is something called .Stats which claims to do the same thing but this just doesn't work.
0
votes
1 Answers
3
votes
All query descriptors have method to set name.
For example, range:
var response = client.Search<Product>(s => s
.Query(q => q.Range(dr => dr.Name("_range").Field(f => f.Price1).LessThan(1)))
);
which produces following query to ES:
{
"query" : {
"range" : {
"price1" : {
"_name" : "_range",
"lt" : 1.0
}
}
}
}
Hope it helps.