Skip to content

Commit 09aab06

Browse files
committed
Update api_methods.asciidoc
updated client.percolate examples to work with latest (reflecting changes to Percolator API as described here: https://www.elastic.co/blog/percolator-redesign-blog-post)
1 parent c025fd5 commit 09aab06

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

docs/api_methods.asciidoc

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1269,8 +1269,8 @@ The default method is `POST` and the usual <<api-conventions,params and return v
12691269
[source,js]
12701270
---------
12711271
client.index({
1272-
index: '_percolator',
1273-
type: 'myindex',
1272+
index: 'myindex',
1273+
type: '.percolator',
12741274
id: 'alert-1',
12751275
body: {
12761276
// This query will be run against documents sent to percolate
@@ -1285,8 +1285,8 @@ client.index({
12851285
});
12861286
12871287
client.index({
1288-
index: '_percolator',
1289-
type: 'myindex',
1288+
index: 'myindex',
1289+
type: '.percolator',
12901290
id: 'alert-2',
12911291
body: {
12921292
// This query will also be run against documents sent to percolate
@@ -1306,6 +1306,7 @@ client.index({
13061306
---------
13071307
client.percolate({
13081308
index: 'myindex',
1309+
type: 'mytype',
13091310
body: {
13101311
doc: {
13111312
title: "Foo"
@@ -1314,13 +1315,14 @@ client.percolate({
13141315
}, function (error, response) {
13151316
// response would equal
13161317
// {
1317-
// ok:true,
1318-
// matches: [ "alert-1" ]
1318+
// total: 1,
1319+
// matches: [ { _index: 'myindex', _id: 'alert-1' } ]
13191320
// }
13201321
});
13211322
13221323
client.percolate({
13231324
index: 'myindex',
1325+
type: 'mytype',
13241326
body: {
13251327
doc: {
13261328
title: "Foo Bar"
@@ -1329,8 +1331,11 @@ client.percolate({
13291331
}, function (error, response) {
13301332
// response would equal
13311333
// {
1332-
// ok:true,
1333-
// matches: [ "alert-1", "alert-2" ]
1334+
// total: 2,
1335+
// matches: [
1336+
// { _index: 'myindex', _id: 'alert-1' },
1337+
// { _index: 'myindex', _id: 'alert-2' }
1338+
// ]
13341339
// }
13351340
});
13361341
---------

0 commit comments

Comments
 (0)