mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-24 05:06:02 +08:00
35 lines
635 B
TypeScript
35 lines
635 B
TypeScript
/// <reference path="elasticsearch.d.ts"/>
|
|
import elasticsearch = require("elasticsearch");
|
|
|
|
var client = new elasticsearch.Client({
|
|
host: 'localhost:9200',
|
|
log: 'trace'
|
|
});
|
|
|
|
client = new elasticsearch.Client({
|
|
hosts: [
|
|
'box1.server.org',
|
|
'box2.server.org'
|
|
],
|
|
selector: function (hosts: any) { }
|
|
});
|
|
|
|
client.ping({
|
|
requestTimeout: 30000,
|
|
hello: "elasticsearch"
|
|
}, function (error) {
|
|
});
|
|
|
|
client.search({
|
|
q: 'pants'
|
|
}).then(function (body) {
|
|
var hits = body.hits.hits;
|
|
}, function (error) {
|
|
});
|
|
|
|
client.indices.delete({
|
|
index: 'test_index',
|
|
ignore: [404]
|
|
}).then(function (body) {
|
|
}, function (error) {
|
|
}); |