015-elasticsearch-搜索模板,多搜索模板,

Posted bjlhx

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了015-elasticsearch-搜索模板,多搜索模板,相关的知识,希望对你有一定的参考价值。

一、搜索模板

查看地址

二、多搜索模板

查看地址

三、搜索分片API

  搜索分片api返回将执行搜索请求的索引和分片。这可以提供有用的反馈,用于解决问题或使用路由和分片首选项进行规划优化。使用过滤别名时,过滤器将作为索引部分的一部分返回。

  索引和类型参数可以是单个值,也可以逗号分隔。

  类型参数已弃用【5.1.0】

示例:

GET /twitter/_search_shards
技术分享图片
{
  "nodes": ...,
  "indices" : {
    "twitter": { }
  },
  "shards": [
    [
      {
        "index": "twitter",
        "node": "JklnKbD7Tyqi9TP3_Q_tBg",
        "primary": true,
        "shard": 0,
        "state": "STARTED",
        "allocation_id": {"id":"0TvkCyF7TAmM1wHP4a42-A"},
        "relocating_node": null
      }
    ],
    [
      {
        "index": "twitter",
        "node": "JklnKbD7Tyqi9TP3_Q_tBg",
        "primary": true,
        "shard": 1,
        "state": "STARTED",
        "allocation_id": {"id":"fMju3hd1QHWmWrIgFnI4Ww"},
        "relocating_node": null
      }
    ],
    [
      {
        "index": "twitter",
        "node": "JklnKbD7Tyqi9TP3_Q_tBg",
        "primary": true,
        "shard": 2,
        "state": "STARTED",
        "allocation_id": {"id":"Nwl0wbMBTHCWjEEbGYGapg"},
        "relocating_node": null
      }
    ],
    [
      {
        "index": "twitter",
        "node": "JklnKbD7Tyqi9TP3_Q_tBg",
        "primary": true,
        "shard": 3,
        "state": "STARTED",
        "allocation_id": {"id":"bU_KLGJISbW0RejwnwDPKw"},
        "relocating_node": null
      }
    ],
    [
      {
        "index": "twitter",
        "node": "JklnKbD7Tyqi9TP3_Q_tBg",
        "primary": true,
        "shard": 4,
        "state": "STARTED",
        "allocation_id": {"id":"DMs7_giNSwmdqVukF7UydA"},
        "relocating_node": null
      }
    ]
  ]
}
View Code

指定相同的请求,这次使用路由值:

GET /twitter/_search_shards?routing=foo,baz
技术分享图片
{
  "nodes": ...,
  "indices" : {
      "twitter": { }
  },
  "shards": [
    [
      {
        "index": "twitter",
        "node": "JklnKbD7Tyqi9TP3_Q_tBg",
        "primary": true,
        "shard": 0,
        "state": "STARTED",
        "allocation_id": {"id":"0TvkCyF7TAmM1wHP4a42-A"},
        "relocating_node": null
      }
    ],
    [
      {
        "index": "twitter",
        "node": "JklnKbD7Tyqi9TP3_Q_tBg",
        "primary": true,
        "shard": 1,
        "state": "STARTED",
        "allocation_id": {"id":"fMju3hd1QHWmWrIgFnI4Ww"},
        "relocating_node": null
      }
    ]
  ]
}
View Code

这次搜索只会针对两个分片执行,因为已经指定了路由值。

参数:

  

routing

A comma-separated list of routing values to take into account when determining which shards a request would be executed against.

在确定要执行的请求分片时要考虑的路由值的逗号分隔列表。

preference

Controls a preference of which shard replicas to execute the search request on. By default, the operation is randomized between the shard replicas. See the preferencedocumentation for a list of all acceptable values.

控制哪个分片副本在其上执行搜索请求的首选项。默认情况下,该操作在碎片副本之间随机化。请参阅首选项文档以获取所有可接受值的列表。

local

A boolean value whether to read the cluster state locally in order to determine where shards are allocated instead of using the Master node’s cluster state.

一个布尔值,是否在本地读取群集状态以确定分配分片的位置,而不是使用主节点的群集状态。

四、建议功能

参看地址

五、多搜索API

查看地址

 

以上是关于015-elasticsearch-搜索模板,多搜索模板,的主要内容,如果未能解决你的问题,请参考以下文章

[CF842C]Ilya And The Tree

ElasticSearch模板搜索API

如何修改drupal搜索模板?

slash (/) 的用法

text 搜索表单块核心模板核心/模板

WooCommerce 搜索结果模板