percolator.asciidoc 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. [[breaking_50_percolator]]
  2. === Percolator changes
  3. ==== Percolator is near-real time
  4. Previously percolators were activated in real-time, i.e. as soon as they were
  5. indexed. Now, changes to the `percolate` query are visible in near-real time,
  6. as soon as the index has been refreshed. This change was required because, in
  7. indices created from 5.0 onwards, the terms used in a percolator query are
  8. automatically indexed to allow for more efficient query selection during
  9. percolation.
  10. ==== Percolate and multi percolator APIs
  11. Percolator and multi percolate APIs have been deprecated and will be removed in the next major release. These APIs have
  12. been replaced by the `percolate` query that can be used in the search and multi search APIs.
  13. ==== Percolator field mapping
  14. The `.percolator` type can no longer be used to index percolator queries.
  15. Instead a <<percolator,percolator field type>> must be configured prior to indexing percolator queries.
  16. Indices with a `.percolator` type created on a version before 5.0.0 can still be used,
  17. but new indices no longer accept the `.percolator` type.
  18. ==== Percolate document mapping
  19. The `percolate` query no longer modifies the mappings. Before the percolate API
  20. could be used to dynamically introduce new fields to the mappings based on the
  21. fields in the document being percolated. This no longer works, because these
  22. unmapped fields are not persisted in the mapping.
  23. ==== Percolator documents returned by search
  24. Documents with the `.percolate` type were previously excluded from the search
  25. response, unless the `.percolate` type was specified explicitly in the search
  26. request. Now, percolator documents are treated in the same way as any other
  27. document and are returned by search requests.
  28. ==== Percolating existing document
  29. When percolating an existing document then also specifying a document as source in the
  30. `percolate` query is not allowed any more. Before the percolate API allowed and ignored
  31. the existing document.
  32. ==== Percolate Stats
  33. The percolate stats have been removed. This is because the percolator no longer caches the percolator queries.
  34. ==== Percolator queries containing range queries with now ranges
  35. The percolator no longer accepts percolator queries containing `range` queries with ranges that are based on current
  36. time (using `now`).
  37. ==== Java client
  38. The percolator is no longer part of the core elasticsearch dependency. It has moved to the percolator module.
  39. Therefor when using the percolator feature from the Java client the new percolator module should also be on the
  40. classpath. Also the transport client should load the percolator module as plugin:
  41. [source,java]
  42. --------------------------------------------------
  43. TransportClient transportClient = TransportClient.builder()
  44. .settings(Settings.builder().put("node.name", "node"))
  45. .addPlugin(PercolatorPlugin.class)
  46. .build();
  47. transportClient.addTransportAddress(
  48. new InetSocketTransportAddress(new InetSocketAddress(InetAddresses.forString("127.0.0.1"), 9300))
  49. );
  50. --------------------------------------------------
  51. The percolator and multi percolate related methods from the `Client` interface have been removed. These APIs have been
  52. deprecated and it is recommended to use the `percolate` query in either the search or multi search APIs. However the
  53. percolate and multi percolate APIs can still be used from the Java client.
  54. Using percolate request:
  55. [source,java]
  56. --------------------------------------------------
  57. PercolateRequest request = new PercolateRequest();
  58. // set stuff and then execute:
  59. PercolateResponse response = transportClient.execute(PercolateAction.INSTANCE, request).actionGet();
  60. --------------------------------------------------
  61. Using percolate request builder:
  62. [source,java]
  63. --------------------------------------------------
  64. PercolateRequestBuilder builder = new PercolateRequestBuilder(transportClient, PercolateAction.INSTANCE);
  65. // set stuff and then execute:
  66. PercolateResponse response = builder.get();
  67. --------------------------------------------------
  68. Using multi percolate request:
  69. [source,java]
  70. --------------------------------------------------
  71. MultiPercolateRequest request = new MultiPercolateRequest();
  72. // set stuff and then execute:
  73. MultiPercolateResponse response = transportClient.execute(MultiPercolateAction.INSTANCE, request).get();
  74. --------------------------------------------------
  75. Using multi percolate request builder:
  76. [source,java]
  77. --------------------------------------------------
  78. MultiPercolateRequestBuilder builder = new MultiPercolateRequestBuilder(transportClient, MultiPercolateAction.INSTANCE);
  79. // set stuff and then execute:
  80. MultiPercolateResponse response = builder.get();
  81. --------------------------------------------------