Kibana中doc与search策略的区别

简介:

在kibana中包含两种策略:doc和search。使用了两个循环队列来获取请求,并进行响应。

doc的代码如下:
clientMethod: 'mget'

search的代码如下:
clientMethod: 'msearch'

通过查询api可以发现:

mget命令,可以执行多个查询。但是查询条件基本是index,type,id这种

client.mget({
  body: {
    docs: [
      { _index: 'indexA', _type: 'typeA', _id: '1' },
      { _index: 'indexB', _type: 'typeB', _id: '1' },
      { _index: 'indexC', _type: 'typeC', _id: '1' }
    ]
  }
}, function(error, response){
  // ...
});

或者

client.mget({
  index: 'myindex',
  type: 'mytype',
  body: {
    ids: [1, 2, 3]
  }
}, function(error, response){
  // ...
});

msearch命令,则可以实现复杂的查询,例如:

client.msearch({
  body: [
    // match all query, on all indices and types
    {},
    { query: { match_all: {} } },

    // query_string query, on index/mytype
    { _index: 'myindex', _type: 'mytype' },
    { query: { query_string: { query: '"Test 1"' } } }
  ]
});
本文转自博客园xingoo的博客,原文链接: Kibana中doc与search策略的区别,如需转载请自行联系原博主。

相关文章
|
存储 SQL JSON
Elasticsearch Search API之搜索模板(search Template)
Elasticsearch Search API之搜索模板(search Template)
Elasticsearch Search API之搜索模板(search Template)
|
监控 API UED
Elasticsearch 异步搜索 Async search 实战
1、Elasticsearch 异步搜索定义 异步搜索 API 可异步执行搜索请求、监控其进度并检索可用的部分结果。 如下的官方介绍动画,能更加生动的介绍清楚异步检索。 传统检索 VS 异步检索,在数据量比较大时: 传统检索可能导致超时,以至于无数据返回;或者需要等待很久,用户体验差。 异步检索,可以快速响应数据,用户无需等待。
886 0
Elasticsearch 异步搜索 Async search 实战
|
测试技术 索引
Elasticsearch search after分页检索案例
Elasticsearch search after分页检索案例分享 The best elasticsearch highlevel java rest api-----bboss 1.准备工作 参考文档《高性能elasticsearch ORM开发库使用介绍》导入和配置es客户端 2.
4911 0
|
6月前
|
存储 索引
创建 elastic search 索引的一些注意事项
创建 elastic search 索引的一些注意事项
59 0
|
10月前
|
自然语言处理 Java 索引
Elastic Search一些用法
Elastic Search一些用法
|
索引
Elastic: 同一条索引,使用GET _cat/indices?v与GET index/_count查询出来的文档数为什么不同?
首先我们来看官方文档中对于_cat/indices的解释: 原文: These metrics are retrieved directly from Lucene, which Elasticsearch uses internally to power indexing and search. As a result, all document counts include hidden nested documents.
128 0
Elastic: 同一条索引,使用GET _cat/indices?v与GET index/_count查询出来的文档数为什么不同?
Elasticsearch搜索模板search tempalte
Elasticsearch搜索模板search tempalte
|
固态存储 架构师 开发工具
|
存储 算法 固态存储
Elasticsearch Index Setting一览表
Elasticsearch Index Setting一览表
Elasticsearch Index Setting一览表
|
缓存 算法 关系型数据库
Elasticsearch Search API 概述与URI Search
Elasticsearch Search API 概述与URI Search
Elasticsearch Search API 概述与URI Search