Merge pull request #222 from zoellner/patch-1

Update api_methods.asciidoc
This commit is contained in:
Spencer
2015-06-05 13:54:45 -07:00

View File

@ -2,8 +2,8 @@
[source,js] [source,js]
--------- ---------
client.index({ client.index({
index: '_percolator', index: 'myindex',
type: 'myindex', type: '.percolator',
id: 'alert-1', id: 'alert-1',
body: { body: {
// This query will be run against documents sent to percolate // This query will be run against documents sent to percolate
@ -18,8 +18,8 @@ client.index({
}); });
client.index({ client.index({
index: '_percolator', index: 'myindex',
type: 'myindex', type: '.percolator',
id: 'alert-2', id: 'alert-2',
body: { body: {
// This query will also be run against documents sent to percolate // This query will also be run against documents sent to percolate
@ -39,6 +39,7 @@ client.index({
--------- ---------
client.percolate({ client.percolate({
index: 'myindex', index: 'myindex',
type: 'mytype',
body: { body: {
doc: { doc: {
title: "Foo" title: "Foo"
@ -47,13 +48,14 @@ client.percolate({
}, function (error, response) { }, function (error, response) {
// response would equal // response would equal
// { // {
// ok:true, // total: 1,
// matches: [ "alert-1" ] // matches: [ { _index: 'myindex', _id: 'alert-1' } ]
// } // }
}); });
client.percolate({ client.percolate({
index: 'myindex', index: 'myindex',
type: 'mytype',
body: { body: {
doc: { doc: {
title: "Foo Bar" title: "Foo Bar"
@ -62,8 +64,11 @@ client.percolate({
}, function (error, response) { }, function (error, response) {
// response would equal // response would equal
// { // {
// ok:true, // total: 2,
// matches: [ "alert-1", "alert-2" ] // matches: [
// { _index: 'myindex', _id: 'alert-1' },
// { _index: 'myindex', _id: 'alert-2' }
// ]
// } // }
}); });
--------- ---------