IMPORTANT: This documentation is no longer updated. Refer to Elastic's version policy and the latest documentation.

Percolation

edit

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 Percolator

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

Percolate a Document

edit
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 Percolator

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

Percolate from a Bulk index action

edit

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