Percolationedit

The 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 Percolatoredit

client.RegisterPercolator<ElasticsearchProject>("my-percolator", p => p
    .Query(q => q
        .Term(f => f.Name, "NEST")
    )
);

Percolate a Documentedit

var 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 Percolatoredit

client.UnregisterPercolator<ElasticsearchProject>("my-percolator");

Percolate from a Bulk index actionedit

It’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
    )
);