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)
|
6天前
|
搜索推荐 算法 数据挖掘
探索 Elasticsearch 8.X Terms Set 检索的应用与原理
探索 Elasticsearch 8.X Terms Set 检索的应用与原理
16 0
|
6天前
|
自然语言处理
elasticsearch中term与match区别
elasticsearch中term与match区别
44 0
|
7月前
|
存储 索引
创建 elastic search 索引的一些注意事项
创建 elastic search 索引的一些注意事项
74 0
|
索引
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.
152 0
Elastic: 同一条索引,使用GET _cat/indices?v与GET index/_count查询出来的文档数为什么不同?
|
自然语言处理
ElasticSearch中match和term的区别(第六更)
ElasticSearch中match和term的区别(第六更)
ElasticSearch中match和term的区别(第六更)
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