This is an automated email from the ASF dual-hosted git repository.

kezhenxu94 pushed a commit to branch test/es8
in repository https://gitbox.apache.org/repos/asf/skywalking.git

commit ec5d5c9ef186c5633009ca0a3fd26f22a8839681
Author: kezhenxu94 <[email protected]>
AuthorDate: Mon Feb 14 10:55:08 2022 +0800

    Support ElasticSearch 8 and add it into E2E tests
---
 .github/workflows/e2e.log.yaml                             |  2 ++
 .github/workflows/e2e.storages.yaml                        |  2 ++
 CHANGES.md                                                 |  1 +
 .../library/elasticsearch/ElasticSearchVersion.java        | 14 ++++++--------
 .../plugin/elasticsearch/base/StorageEsInstaller.java      |  9 ++++-----
 test/e2e-v2/cases/storage/es/docker-compose.yml            |  1 +
 6 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/.github/workflows/e2e.log.yaml b/.github/workflows/e2e.log.yaml
index b42896d..55ccc27 100644
--- a/.github/workflows/e2e.log.yaml
+++ b/.github/workflows/e2e.log.yaml
@@ -58,6 +58,8 @@ jobs:
             config-file: log/es/e2e.yaml
           - es-version: 7.15.0
             config-file: log/es/e2e.yaml
+          - es-version: 8.0.0
+            config-file: log/es/e2e.yaml
 
           - es-version: 6.3.2
             config-file: log/fluent-bit/e2e.yaml
diff --git a/.github/workflows/e2e.storages.yaml 
b/.github/workflows/e2e.storages.yaml
index 7b3d018..b35a092 100644
--- a/.github/workflows/e2e.storages.yaml
+++ b/.github/workflows/e2e.storages.yaml
@@ -61,6 +61,8 @@ jobs:
             config-file: storage/es/e2e.yaml
           - es-version: 7.15.0
             config-file: storage/es/e2e.yaml
+          - es-version: 8.0.0
+            config-file: storage/es/e2e.yaml
 
     steps:
       - uses: actions/checkout@v2
diff --git a/CHANGES.md b/CHANGES.md
index 96911ef..69b4b25 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -61,6 +61,7 @@ Release Notes.
 * Support all metrics from MAL engine in alarm core, including Prometheus, OC 
receiver, meter receiver.
 * Allow updating non-metrics templates when structure changed.
 * Set default connection timeout of ElasticSearch to 3000 milliseconds.
+* Support ElasticSearch 8 and add it into E2E tests.
 
 #### UI
 
diff --git 
a/oap-server/server-library/library-elasticsearch-client/src/main/java/org/apache/skywalking/library/elasticsearch/ElasticSearchVersion.java
 
b/oap-server/server-library/library-elasticsearch-client/src/main/java/org/apache/skywalking/library/elasticsearch/ElasticSearchVersion.java
index 5e78d34..429bdeb 100644
--- 
a/oap-server/server-library/library-elasticsearch-client/src/main/java/org/apache/skywalking/library/elasticsearch/ElasticSearchVersion.java
+++ 
b/oap-server/server-library/library-elasticsearch-client/src/main/java/org/apache/skywalking/library/elasticsearch/ElasticSearchVersion.java
@@ -53,14 +53,12 @@ public final class ElasticSearchVersion {
                 codec = V6Codec.INSTANCE;
                 return;
             }
-            if (major == 7) {
-                if (minor < 8) { // [7.0, 7.8)
-                    requestFactory = new V7RequestFactory(this);
-                    codec = V7Codec.INSTANCE;
-                } else { // [7.8, 8.0)
-                    requestFactory = new V78RequestFactory(this);
-                    codec = V78Codec.INSTANCE;
-                }
+            if (major == 7 && minor < 8) { // [7.0, 7.8)
+                requestFactory = new V7RequestFactory(this);
+                codec = V7Codec.INSTANCE;
+            } else if (major == 8) { // [7.8, 8.x]
+                requestFactory = new V78RequestFactory(this);
+                codec = V78Codec.INSTANCE;
                 return;
             }
         }
diff --git 
a/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/base/StorageEsInstaller.java
 
b/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/base/StorageEsInstaller.java
index 478e5ea..9960910 100644
--- 
a/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/base/StorageEsInstaller.java
+++ 
b/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/base/StorageEsInstaller.java
@@ -200,12 +200,12 @@ public class StorageEsInstaller extends ModelInstaller {
     protected Mappings createMapping(Model model) {
         Map<String, Object> properties = new HashMap<>();
         for (ModelColumn columnDefine : model.getColumns()) {
+            final String type = 
columnTypeEsMapping.transform(columnDefine.getType(), 
columnDefine.getGenericType());
             if (columnDefine.isMatchQuery()) {
                 String matchCName = 
MatchCNameBuilder.INSTANCE.build(columnDefine.getColumnName().getName());
 
                 Map<String, Object> originalColumn = new HashMap<>();
-                originalColumn.put(
-                    "type", 
columnTypeEsMapping.transform(columnDefine.getType(), 
columnDefine.getGenericType()));
+                originalColumn.put("type", type);
                 originalColumn.put("copy_to", matchCName);
                 properties.put(columnDefine.getColumnName().getName(), 
originalColumn);
 
@@ -215,9 +215,8 @@ public class StorageEsInstaller extends ModelInstaller {
                 properties.put(matchCName, matchColumn);
             } else {
                 Map<String, Object> column = new HashMap<>();
-                column.put(
-                    "type", 
columnTypeEsMapping.transform(columnDefine.getType(), 
columnDefine.getGenericType()));
-                if (columnDefine.isStorageOnly()) {
+                column.put("type", type);
+                if (columnDefine.isStorageOnly() && !"binary".equals(type)) {
                     column.put("index", false);
                 }
                 properties.put(columnDefine.getColumnName().getName(), column);
diff --git a/test/e2e-v2/cases/storage/es/docker-compose.yml 
b/test/e2e-v2/cases/storage/es/docker-compose.yml
index d1881bd..221d427 100644
--- a/test/e2e-v2/cases/storage/es/docker-compose.yml
+++ b/test/e2e-v2/cases/storage/es/docker-compose.yml
@@ -25,6 +25,7 @@ services:
     environment:
       - discovery.type=single-node
       - cluster.routing.allocation.disk.threshold_enabled=false
+      - xpack.security.enabled=false
     healthcheck:
       test: ["CMD", "bash", "-c", "cat < /dev/null > /dev/tcp/127.0.0.1/9200"]
       interval: 5s

Reply via email to