Intro ElasticSearch Upgrade From 7.3.2 To 7.17.3 Memo

Intro ElasticSearch Upgrade From 7.3.2 To 7.17.3 Memo

這篇介紹ElasticSearch Upgrade From 7.3.2 To 7.17.3 Memo.

前情提要

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
ElasticSearch server版本升級從7.3.2 to 7.17.3

Server需安裝7.17.3

Client:
pom.xml

<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<version>7.17.3</version>
</dependency>
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-high-level-client</artifactId>
<version>7.17.3</version>
</dependency>

相關程式異動

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
- import org.elasticsearch.common.unit.TimeValue;
切換
+ import org.elasticsearch.core.TimeValue;

在catalina.out會出現
2022-05-23 10:51:48,551 WARN [org.elasticsearch.client.RestClient]
- request [POST http://{aaa}/{bbb}/_search?
typed_keys=true&max_concurrent_shard_requests=5&
ignore_unavailable=true&expand_wildcards=open%2Cclosed
&allow_no_indices=true&ignore_throttled=false&
search_type=query_then_fetch&batched_reduce_size=512]
returned 1 warnings: [299 Elasticsearch-7.17.3-5ad023604c8d7416c9eb6c0eadb62b14e766caff
"[ignore_throttled] parameter is deprecated because frozen indices have been deprecated.
Consider cold or frozen tiers in place of frozen indices."]

需調整indicesOptions參數
原本使用:
SearchRequest searchRequest = new SearchRequest(indexName)
.indicesOptions(IndicesOptions.LENIENT_EXPAND_OPEN_CLOSED);
切換使用:
SearchRequest searchRequest = new SearchRequest(indexName)
.indicesOptions(
IndicesOptions.fromOptions(true, true, true, true, false, true, false, false, true));
最後一個參數 true -> 不查詢frozen index -> 不會出現WARM log