From f3dcfd77f6942904353d2ab703c92038860a5098 Mon Sep 17 00:00:00 2001 From: asahi Date: Tue, 31 Dec 2024 12:43:05 +0800 Subject: [PATCH] =?UTF-8?q?=E9=98=85=E8=AF=BBes=20index=20module=E6=96=87?= =?UTF-8?q?=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- elastic search/02_elastic_search_index.md | 44 +++++++++++++++++++++-- 1 file changed, 41 insertions(+), 3 deletions(-) diff --git a/elastic search/02_elastic_search_index.md b/elastic search/02_elastic_search_index.md index 02cb943..a89e234 100644 --- a/elastic search/02_elastic_search_index.md +++ b/elastic search/02_elastic_search_index.md @@ -72,8 +72,46 @@ index blocks限制了针对特定索引的操作类型。操作阻塞的类型 # PUT //_block/ PUT /my-index-000001/_block/write ``` -参数示例: -- `index`: 由`,`分隔的列表或通配符表达式,代表该请求的索引名称 - - 默认情况下,需要显式指定 +#### path param +- ``: 由`,`分隔的列表或通配符表达式,代表该请求的索引名称 + - 默认情况下,``部分需要指定索引的精确名称。如果想要使用`_all, *`等通配表达式,需要将`action.destructive_requires_name`属性设置为`false`。 +- ``: 向索引应用的阻塞类型 + - <block>部分可选的值为`metadata, read, read_only, write` + +#### query param +- `allow_no_indices`: + - 如果该参数设置为false,那么当索引项中任一`wildcard expression, idnex alias或_all`值没有匹配的索引或只能匹配到closed状态的索引,那么该请求会返回异常。 + - 例如`foo*,bar*`,`foo*`表达式匹配到索引,但是`bar*`没有相匹配的索引,那么会抛出异常。 + - 该参数认值为`true` +- `expand_wildcards`: + - wildcard pattern能够匹配到的索引类型。如果请求能够匹配到data stream,那么该参数能够决定wildcard pattern能够匹配到hidden data stream + - 该参数的值支持`,`分隔,有效的值如下: + - `all`:匹配任何data stream或index,包括hidden的 + - `open`:匹配`open, non-hidden`状态的索引和`non-hidden`状态的data stream + - `closed`:匹配`closed, non-hidden`状态的索引和`non-hidden`状态的data stream + - `hidden`:匹配`hidden`状态的索引和`hidden`状态的data stream。`hidden`必须和`open, closed`中任一组合使用,也能和两者一起使用`open, closed, hidden` + - `none`:不接受wildcard pattern + - 该参数默认值为`open` + - `ignore_unavailable`: 如果参数设置为false,若未匹配到索引或匹配到closed状态的索引,返回异常 + - 该参数默认值为`false` + - `master_timeout`:等待master node的最大时间,默认为`30s`,如果超过该限制master node仍然不可访问,那么该请求会返回异常 + - `timeout`:在更新完metadata后,等待cluster中所有节点返回的时间限制,默认为`30s`。如果超时后仍未能接受到返回,那么针对cluster metadata的修改仍然会被应用,但是在返回中会指定并非接受到了所有的ack + +#### 示例 +添加write block的示例如下所示: +``` +PUT /my-index-000001/_block/write +``` +返回结果如下: +``` +{ + "acknowledged" : true, + "shards_acknowledged" : true, + "indices" : [ { + "name" : "my-index-000001", + "blocked" : true + } ] +} +```