当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript Client.ping方法代码示例

本文整理汇总了TypeScript中elasticsearch.Client.ping方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Client.ping方法的具体用法?TypeScript Client.ping怎么用?TypeScript Client.ping使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在elasticsearch.Client的用法示例。


在下文中一共展示了Client.ping方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: isAvailable

 isAvailable(): Promise<any> {
     var client = new elasticsearch.Client({
         host: 'http://localhost:9200',
         log: 'trace'
     });
     return client.ping({
         requestTimeout: Infinity,
         hello: "elasticsearch!"
     });
 }
开发者ID:cwdonnelly,项目名称:angular2-elastic,代码行数:10,代码来源:elasticsearch.service.ts

示例2: before

    before(done => {
        client = new ElasticSearch.Client({
            host: "localhost:9200",
            apiVersion: "2.3"
        });

        client.ping({
            requestTimeout: Infinity
        }, error => {
            if (error) {
                done(error);
            } else {
                done();
            }
        });
    });
开发者ID:martyn82,项目名称:aphajs,代码行数:16,代码来源:ElasticSearchProjectionStorage.spec.ts

示例3:

let client = new elasticsearch.Client({
  host: 'localhost:9200',
  log: 'trace'
});

client = new elasticsearch.Client({
  hosts: [
    'box1.server.org',
    'box2.server.org'
  ],
  selector: (hosts: any) => { }
});

client.ping({
  requestTimeout: 30000
}, (error) => {
});

client.search({
  q: 'pants'
}).then((body) => {
  const hits = body.hits.hits;
}, (error) => {
});

client.indices.delete({
  index: 'test_index',
  ignore: [404]
}).then((body) => {
}, (error) => {
});
开发者ID:Dru89,项目名称:DefinitelyTyped,代码行数:31,代码来源:elasticsearch-tests.ts

示例4:

import * as elasticsearch from 'elasticsearch';
import config from '../config';

// Init ElasticSearch connection
const client = new elasticsearch.Client({
	host: `${config.elasticsearch.host}:${config.elasticsearch.port}`
});

// Send a HEAD request
client.ping({
	// Ping usually has a 3000ms timeout
	requestTimeout: Infinity,

	// Undocumented params are appended to the query string
	hello: 'elasticsearch!'
}, error => {
	if (error) {
		console.error('elasticsearch is down!');
	}
});

export default client;
开发者ID:syuilo,项目名称:misskey-core,代码行数:22,代码来源:elasticsearch.ts

示例5: require

//////////////////////////////////////////////////
// SEARCH DB
//////////////////////////////////////////////////

import * as cluster from 'cluster';
const elasticsearch = require('elasticsearch');
import config from '../config';

// init ElasticSearch connection
const client = new elasticsearch.Client({
	host: `${config.elasticsearch.host}:${config.elasticsearch.port}`
});

// Send a HEAD request
client.ping({
	// ping usually has a 3000ms timeout
	requestTimeout: Infinity,

	// undocumented params are appended to the query string
	hello: "elasticsearch!"
}, (error: any) => {
	if (error) {
		console.error('elasticsearch cluster is down!');
	} else {
		console.log(`[${cluster.worker.id}] Connected to Elasticsearch`);
	}
});

export default client;
开发者ID:syuilo,项目名称:ssmato.me,代码行数:29,代码来源:es.ts

示例6: isAvailable

 isAvailable(): any {
     return this._client.ping({
         requestTimeout: Infinity,
         hello: "elasticsearch!"
     });
 }
开发者ID:byavv,项目名称:angular2-elastic,代码行数:6,代码来源:elasticsearch.service.ts


注:本文中的elasticsearch.Client.ping方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。