mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-04-25 15:47:23 -04:00
percolator: Replace percolate api with the new percolator query
Also replaced the PercolatorQueryRegistry with the new PercolatorQueryCache. The PercolatorFieldMapper stores the rewritten form of each percolator query's xcontext in a binary doc values field. This make sure that the query rewrite happens only during indexing (some queries for example fetch shapes, terms in remote indices) and the speed up the loading of the queries in the percolator query cache. Because the percolator now works inside the search infrastructure a number of features (sorting fields, pagination, fetch features) are available out of the box. The following feature requests are automatically implemented via this refactoring: Closes #10741 Closes #7297 Closes #13176 Closes #13978 Closes #11264 Closes #10741 Closes #4317
This commit is contained in:
parent
032678f0c3
commit
e3b7e5d75a
97 changed files with 3089 additions and 5628 deletions
|
@ -142,8 +142,6 @@ include::search.asciidoc[]
|
|||
|
||||
include::aggs.asciidoc[]
|
||||
|
||||
include::percolate.asciidoc[]
|
||||
|
||||
include::query-dsl.asciidoc[]
|
||||
|
||||
include::indexed-scripts.asciidoc[]
|
||||
|
|
|
@ -1,12 +1,8 @@
|
|||
[[percolate]]
|
||||
== Percolate API
|
||||
[[java-query-percolator-query]]
|
||||
==== Percolator query
|
||||
|
||||
The percolator allows one to register queries against an index, and then
|
||||
send `percolate` requests which include a doc, getting back the
|
||||
queries that match on that doc out of the set of registered queries.
|
||||
|
||||
Read the main {ref}/search-percolate.html[percolate]
|
||||
documentation before reading this guide.
|
||||
See:
|
||||
* {ref}/query-percolator-query.html[Percolator Query]
|
||||
|
||||
[source,java]
|
||||
--------------------------------------------------
|
||||
|
@ -37,14 +33,12 @@ docBuilder.field("doc").startObject(); //This is needed to designate the documen
|
|||
docBuilder.field("content", "This is amazing!");
|
||||
docBuilder.endObject(); //End of the doc field
|
||||
docBuilder.endObject(); //End of the JSON root object
|
||||
//Percolate
|
||||
PercolateResponse response = client.preparePercolate()
|
||||
.setIndices("myIndexName")
|
||||
.setDocumentType("myDocumentType")
|
||||
.setSource(docBuilder).execute().actionGet();
|
||||
// Percolate, by executing the percolator query in the query dsl:
|
||||
SearchResponse response = client().prepareSearch("myIndexName")
|
||||
.setQuery(QueryBuilders.percolatorQuery("myDocumentType", docBuilder.bytes()))
|
||||
.get();
|
||||
//Iterate over the results
|
||||
for(PercolateResponse.Match match : response) {
|
||||
//Handle the result which is the name of
|
||||
//the query in the percolator
|
||||
for(SearchHit hit : response.getHits()) {
|
||||
// Percolator queries as hit
|
||||
}
|
||||
--------------------------------------------------
|
|
@ -27,3 +27,5 @@ include::template-query.asciidoc[]
|
|||
|
||||
include::script-query.asciidoc[]
|
||||
|
||||
include::percolator-query.asciidoc[]
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue