WARNING: Version 5.x has passed its EOL date.
This documentation is no longer being maintained and may be removed. If you are running this version, we strongly advise you to upgrade. For the latest information, see the current release documentation.
Percolation
editPercolation
editThe percolator allows to register queries against an index, then send percolate requests which include a doc, and get back the queries that match on that doc out of the set of registered queries.
Percolate is a complex but awesome Elasticsearch feature, so be sure to read the {ref_current}/search-percolate.html[official documentation].
Register a Percolator
editclient.RegisterPercolator<ElasticsearchProject>("my-percolator", p => p .Query(q => q .Term(f => f.Name, "NEST") ) );
Percolate a Document
editvar project = new ElasticsearchProject { Id = 1, Name = "NEST", Country = "Netherlands" }; var result = client.Percolate<ElasticsearchProject>(p => p.Document(project));
result.Matches
will contain any percolators that matched the given document project
.
Unregister a Percolator
editclient.UnregisterPercolator<ElasticsearchProject>("my-percolator");
Percolate from a Bulk index action
editIt’s also possible to percolate while bulk indexing:
client.Bulk(b => b .Index<ElasticsearchProject>(i => i .Document(new ElasticsearchProject { Id = 1, Name = "NEST" }) .Percolate("*") // Match on any percolated docs ) );