@ -1269,8 +1269,8 @@ The default method is `POST` and the usual <<api-conventions,params and return v
|
|||||||
[source,js]
|
[source,js]
|
||||||
---------
|
---------
|
||||||
client.index({
|
client.index({
|
||||||
index: 'myindex',
|
index: '_percolator',
|
||||||
type: '.percolator',
|
type: 'myindex',
|
||||||
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
|
||||||
@ -1285,8 +1285,8 @@ client.index({
|
|||||||
});
|
});
|
||||||
|
|
||||||
client.index({
|
client.index({
|
||||||
index: 'myindex',
|
index: '_percolator',
|
||||||
type: '.percolator',
|
type: 'myindex',
|
||||||
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
|
||||||
@ -1306,7 +1306,6 @@ client.index({
|
|||||||
---------
|
---------
|
||||||
client.percolate({
|
client.percolate({
|
||||||
index: 'myindex',
|
index: 'myindex',
|
||||||
type: 'mytype',
|
|
||||||
body: {
|
body: {
|
||||||
doc: {
|
doc: {
|
||||||
title: "Foo"
|
title: "Foo"
|
||||||
@ -1315,14 +1314,13 @@ client.percolate({
|
|||||||
}, function (error, response) {
|
}, function (error, response) {
|
||||||
// response would equal
|
// response would equal
|
||||||
// {
|
// {
|
||||||
// total: 1,
|
// ok:true,
|
||||||
// matches: [ { _index: 'myindex', _id: 'alert-1' } ]
|
// matches: [ "alert-1" ]
|
||||||
// }
|
// }
|
||||||
});
|
});
|
||||||
|
|
||||||
client.percolate({
|
client.percolate({
|
||||||
index: 'myindex',
|
index: 'myindex',
|
||||||
type: 'mytype',
|
|
||||||
body: {
|
body: {
|
||||||
doc: {
|
doc: {
|
||||||
title: "Foo Bar"
|
title: "Foo Bar"
|
||||||
@ -1331,11 +1329,8 @@ client.percolate({
|
|||||||
}, function (error, response) {
|
}, function (error, response) {
|
||||||
// response would equal
|
// response would equal
|
||||||
// {
|
// {
|
||||||
// total: 2,
|
// ok:true,
|
||||||
// matches: [
|
// matches: [ "alert-1", "alert-2" ]
|
||||||
// { _index: 'myindex', _id: 'alert-1' },
|
|
||||||
// { _index: 'myindex', _id: 'alert-2' }
|
|
||||||
// ]
|
|
||||||
// }
|
// }
|
||||||
});
|
});
|
||||||
---------
|
---------
|
||||||
|
|||||||
Reference in New Issue
Block a user