springboot整合es7.8

注:此处spirngboot部分省略,springboot版本为2.3.1.RELEASE,jdk14

背景:在 gradle项目整合flyway、jooq插件 基础上进行

一、引入依赖

implementation group: 'org.elasticsearch.client', name: 'elasticsearch-rest-high-level-client', version: '7.8.0'
implementation group: 'org.elasticsearch.client', name: 'elasticsearch-rest-client', version: '7.8.0'
implementation group: 'org.elasticsearch', name: 'elasticsearch', version: '7.8.0'

二、添加配置

# ES配置
es:
  hosts: "zsx-2.local:9200"
  scheme: http

三、工具类

package com.zsx.utils;

import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j;
import org.apache.http.HttpHost;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.admin.indices.alias.Alias;
import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest;
import org.elasticsearch.action.delete.DeleteRequest;
import org.elasticsearch.action.delete.DeleteResponse;
import org.elasticsearch.action.get.GetRequest;
import org.elasticsearch.action.get.GetResponse;
import org.elasticsearch.action.index.IndexRequest;
import org.elasticsearch.action.index.IndexResponse;
import org.elasticsearch.action.support.ActiveShardCount;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.action.support.WriteRequest;
import org.elasticsearch.action.support.master.AcknowledgedResponse;
import org.elasticsearch.action.update.UpdateRequest;
import org.elasticsearch.action.update.UpdateResponse;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.client.core.GetSourceRequest;
import org.elasticsearch.client.core.GetSourceResponse;
import org.elasticsearch.client.indices.CreateIndexRequest;
import org.elasticsearch.client.indices.CreateIndexResponse;
import org.elasticsearch.client.indices.GetIndexRequest;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.index.VersionType;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.script.Script;
import org.elasticsearch.search.fetch.subphase.FetchSourceContext;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;

import javax.annotation.PostConstruct;
import java.io.IOException;
import java.util.List;
import java.util.Map;

@Slf4j
@Component
public class ESUtils {

    @Value("${es.hosts}")
    private String[] hosts;
    @Value("${es.scheme}")
    private String scheme;

    private RestHighLevelClient restHighLevelClient;

    @PostConstruct
    private void init() {
        try {
            if (restHighLevelClient != null) {
                restHighLevelClient.close();
            }
            HttpHost[] hostArr = new HttpHost[hosts.length];
            for (int i = 0; i < hostArr.length; i++) {
                hostArr[i] = new HttpHost(hosts[i].split(":")[0], Integer.parseInt(hosts[i].split(":")[1]), scheme);
            }
            restHighLevelClient = new RestHighLevelClient(RestClient.builder(hostArr));
        } catch (IOException e) {
            e.printStackTrace();
            log.error(e.getMessage());
        }
    }

    private IndexRequest builderIndexRequest(String indexName, String indexId) {
        IndexRequest request = new IndexRequest(indexName);
        if (!StringUtils.isEmpty(indexId)) {
            request.id(indexId);
        }
        return request;
    }

    private IndexResponse getIndexResponse(IndexRequest request) {
        try {
            return restHighLevelClient.index(request, RequestOptions.DEFAULT);
        } catch (IOException e) {
            e.printStackTrace();
            log.error(e.getMessage());
            return null;
        }
    }

    private GetRequest builderGetRequest(String indexName, String indexId, String[] includes, String[] excludes, String[] fields) {
        GetRequest getRequest = new GetRequest(indexName, indexId);

        // Disable source retrieval, enabled by default
        getRequest.fetchSourceContext(FetchSourceContext.DO_NOT_FETCH_SOURCE);

        FetchSourceContext fetchSourceContext =
                new FetchSourceContext(true, includes, excludes);
        getRequest.fetchSourceContext(fetchSourceContext);

        // Configure retrieval for specific stored fields (requires fields to be stored separately in the mappings)
        getRequest.storedFields(fields);
        return getRequest;
    }

    private GetSourceRequest builderGetSourceRequest(String indexName, String indexId, String[] includes, String[] excludes) {
        GetSourceRequest getSourceRequest = new GetSourceRequest(indexName, indexId);

        // FetchSourceContext 's first argument fetchSource must be true, otherwise ElasticsearchException get thrown
        getSourceRequest.fetchSourceContext(new FetchSourceContext(true, includes, excludes));

        // Optional arguments
        getSourceRequest.routing("routing");
        getSourceRequest.preference("preference");

        // Set realtime flag to false (true by default)
//        getSourceRequest.realtime(false);

        // Perform a refresh before retrieving the document (false by default)
//        getSourceRequest.refresh(true);
        return getSourceRequest;
    }

    private UpdateResponse getUpdateResponse(UpdateRequest request) {
        UpdateResponse response = null;
        try {
            response = restHighLevelClient.update(request, RequestOptions.DEFAULT);
        } catch (IOException e) {
            e.printStackTrace();
            log.error(e.getMessage());
        }
        return response;
    }

    private Settings.Builder getBuilder(Integer shards, Integer replicas) {
        Settings.Builder builder = Settings.builder();
        if (shards != null) {
            builder.put("index.number_of_shards", shards);
        }
        if (replicas != null) {
            builder.put("index.number_of_replicas", replicas);
        }
        return builder;
    }

    private CreateIndexResponse getCreateIndexResponse(CreateIndexRequest request) {
        CreateIndexResponse createIndexResponse = null;
        try {
            createIndexResponse = restHighLevelClient.indices().create(request, RequestOptions.DEFAULT);
        } catch (IOException e) {
            e.printStackTrace();
            log.error(e.getMessage());
        }
        return createIndexResponse;
    }

    private CreateIndexRequest builderCreateIndexRequest(String indexName, Integer shards, Integer replicas) {
        CreateIndexRequest request = new CreateIndexRequest(indexName);

        Settings.Builder builder = getBuilder(shards, replicas);
        // index Settings
        request.settings(builder);
        return request;
    }

    public boolean indexExists(String indexName) {
        GetIndexRequest request = new GetIndexRequest(indexName);

        // Optional arguments
        request.local(false);
        request.humanReadable(true);
        request.includeDefaults(false);
        request.indicesOptions(IndicesOptions.strictExpand());
        try {
            return restHighLevelClient.indices().exists(request, RequestOptions.DEFAULT);
        } catch (IOException e) {
            e.printStackTrace();
            log.error(e.getMessage());
            return false;
        }
    }

    public AcknowledgedResponse deleteIndexByIndexName(String indexName) {
        DeleteIndexRequest request = new DeleteIndexRequest(indexName);

        // Optional arguments, for the all the nodes
        request.timeout(TimeValue.timeValueMinutes(2));
//        request.timeout("2m");

        request.masterNodeTimeout(TimeValue.timeValueMinutes(1));
        request.masterNodeTimeout("1m");

        // Setting IndicesOptions controls how unavailable indices are resolved and how wildcard expressions are expanded
        request.indicesOptions(IndicesOptions.lenientExpandOpen());
        AcknowledgedResponse deleteIndexResponse = null;
        try {
            deleteIndexResponse = restHighLevelClient.indices().delete(request, RequestOptions.DEFAULT);
        } catch (IOException e) {
            e.printStackTrace();
        }
        return deleteIndexResponse;
    }

    public CreateIndexResponse createIndex(String indexName, Integer shards, Integer replicas, String mappingSource, String alias) {

        CreateIndexRequest request = builderCreateIndexRequest(indexName, shards, replicas);

        // index mappings
        request.mapping(mappingSource, XContentType.JSON);

        // index aliases
        request.alias(new Alias(alias).filter(QueryBuilders.termQuery("user", "kimchy")));

        // Optional arguments, for the all the nodes
        request.setTimeout(TimeValue.timeValueMinutes(2));
        request.setMasterTimeout(TimeValue.timeValueMinutes(1));

//        request.waitForActiveShards(ActiveShardCount.from(2));
        request.waitForActiveShards(ActiveShardCount.DEFAULT);

        return getCreateIndexResponse(request);
    }

    public CreateIndexResponse createIndex(String indexName, Integer shards, Integer replicas, Map mapping, String alias) {

        CreateIndexRequest request = builderCreateIndexRequest(indexName, shards, replicas);

        // index mappings
        request.mapping(mapping);

        // index aliases
        request.alias(new Alias(alias).filter(QueryBuilders.termQuery("user", "kimchy")));

        return getCreateIndexResponse(request);
    }

    public CreateIndexResponse createIndex(String indexName, Integer shards, Integer replicas, XContentBuilder xContentBuilder, String alias) {

        CreateIndexRequest request = builderCreateIndexRequest(indexName, shards, replicas);

        // index mappings
        request.mapping(xContentBuilder);

        // index aliases
        request.alias(new Alias(alias).filter(QueryBuilders.termQuery("user", "kimchy")));

        return getCreateIndexResponse(request);
    }

    public CreateIndexResponse createIndex(String indexName, String jsonSource) {
        CreateIndexRequest request = new CreateIndexRequest(indexName);

        request.source(jsonSource, XContentType.JSON);
        return getCreateIndexResponse(request);
    }

    public IndexResponse saveIndexData(String indexName, String indexId, String jsonSource) {
        IndexRequest request = builderIndexRequest(indexName, indexId);
        request.source(jsonSource, XContentType.JSON);
        return getIndexResponse(request);
    }

    public IndexResponse saveIndexData(String indexName, String indexId, Map jsonSource) {
        IndexRequest request = builderIndexRequest(indexName, indexId);
        request.source(jsonSource);
        return getIndexResponse(request);
    }

    public IndexResponse saveIndexData(String indexName, String indexId, XContentBuilder builder) {
        IndexRequest request = builderIndexRequest(indexName, indexId);
        request.source(builder);
        return getIndexResponse(request);
    }

    public IndexResponse saveIndexData(String indexName, String indexId, JSONObject obj) {
        IndexRequest request = builderIndexRequest(indexName, indexId);
        request.source(obj.toMap());
        return getIndexResponse(request);
    }

    public GetResponse getIndexDataById(String indexName, String indexId, String[] includes, String[] excludes, String... fields) {
        GetRequest getRequest = builderGetRequest(indexName, indexId, includes, excludes, fields);
        GetResponse getResponse = null;
        try {
            getResponse = restHighLevelClient.get(getRequest, RequestOptions.DEFAULT);
        } catch (IOException e) {
            e.printStackTrace();
            log.error(e.getMessage());
        }
        return getResponse;
    }

    public GetSourceResponse getIndexSourceDataById(String indexName, String indexId, String[] includes, String[] excludes) {
        GetSourceRequest getSourceRequest = builderGetSourceRequest(indexName, indexId, includes, excludes);

        GetSourceResponse getSourceResponse = null;
        try {
            getSourceResponse = restHighLevelClient.getSource(getSourceRequest, RequestOptions.DEFAULT);
        } catch (IOException e) {
            e.printStackTrace();
            log.error(e.getMessage());
        }
        return getSourceResponse;
    }

    public GetResponse asyncGetIndexDataById(String indexName, String indexId, String[] includes, String[] excludes, String... fields) {
        GetRequest getRequest = builderGetRequest(indexName, indexId, includes, excludes, fields);

        List getResponses = Lists.newArrayList();

        restHighLevelClient.getAsync(getRequest, RequestOptions.DEFAULT, new ActionListener<>() {
            @Override
            public void onResponse(GetResponse response) {
                // Called when the execution is successfully completed
                getResponses.add(response);
            }

            @Override
            public void onFailure(Exception e) {
                // Called when the whole GetSourceRequest fails.
                log.error(e.getMessage());
            }
        });
        while (Thread.activeCount() > 1) {
            if (!getResponses.isEmpty()) {
                System.out.println(getResponses.get(0));
                break;
            }
        }
        return getResponses.get(0);
    }

    public GetSourceResponse asyncGetIndexSourceDataById(String indexName, String indexId, String[] includes, String[] excludes) {
        GetSourceRequest getSourceRequest = builderGetSourceRequest(indexName, indexId, includes, excludes);
        List getSourceResponses = Lists.newArrayList();
        restHighLevelClient.getSourceAsync(getSourceRequest, RequestOptions.DEFAULT, new ActionListener<>() {
            @Override
            public void onResponse(GetSourceResponse response) {
                getSourceResponses.add(response);
            }

            @Override
            public void onFailure(Exception e) {
                log.error(e.getMessage());
            }
        });
        while (Thread.activeCount() > 1) {
            if (!getSourceResponses.isEmpty()) {
                System.out.println(getSourceResponses.get(0));
                break;
            }
        }
        return getSourceResponses.get(0);
    }

    public UpdateResponse updateDataById(String indexName, String indexId, Script inline) {
        UpdateRequest request = new UpdateRequest(indexName, indexId);
        request.script(inline);
        return getUpdateResponse(request);
    }

    public UpdateResponse updateDataById(String indexName, String indexId, String jsonSource) {
        UpdateRequest request = new UpdateRequest(indexName, indexId);
        request.doc(jsonSource, XContentType.JSON);
        return getUpdateResponse(request);
    }

    public UpdateResponse updateDataById(String indexName, String indexId, XContentBuilder builder) {
        UpdateRequest request = new UpdateRequest(indexName, indexId);
        request.doc(builder);
        return getUpdateResponse(request);
    }

    public UpdateResponse updateDataById(String indexName, String indexId, JSONObject obj) {
        UpdateRequest request = new UpdateRequest(indexName, indexId);
        request.doc(obj.toMap());
        return getUpdateResponse(request);
    }

    public DeleteResponse deleteDataById(String indexName, String indexId, Integer version) {
        DeleteRequest request = new DeleteRequest(indexName, indexId);

        // Optional arguments
        request.routing("routing");

        // Timeout to wait for primary shard to become available as a TimeValue
        request.timeout(TimeValue.timeValueMinutes(2));
        // Timeout to wait for primary shard to become available as a String
//        request.timeout("2m");

        // Refresh policy as a WriteRequest.RefreshPolicy instance
        request.setRefreshPolicy(WriteRequest.RefreshPolicy.WAIT_UNTIL);

        // Refresh policy as a String
//        request.setRefreshPolicy("wait_for");

        if (version != null) {
            request.version(version);
        }

        request.versionType(VersionType.EXTERNAL);

        DeleteResponse response = null;
        try {
            response = restHighLevelClient.delete(request, RequestOptions.DEFAULT);
        } catch (IOException e) {
            e.printStackTrace();
            log.error(e.getMessage());
        }
        return response;
    }

}

四、测试类

package com.zsx.utils;

import org.elasticsearch.action.delete.DeleteResponse;
import org.elasticsearch.action.get.GetResponse;
import org.elasticsearch.action.index.IndexResponse;
import org.elasticsearch.action.support.master.AcknowledgedResponse;
import org.elasticsearch.action.update.UpdateResponse;
import org.elasticsearch.client.core.GetSourceResponse;
import org.elasticsearch.client.indices.CreateIndexResponse;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.script.Script;
import org.elasticsearch.script.ScriptType;
import org.json.JSONObject;
import org.junit.jupiter.api.*;
import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit.jupiter.SpringExtension;

import java.io.IOException;
import java.util.*;

import static org.junit.jupiter.api.Assertions.*;

@SpringBootTest
@ExtendWith(SpringExtension.class)
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)  // Set method execution order
public class ESUtilsTest {

    final static List indexNames;

    static {
        indexNames = List.of("posts", "twitter1", "twitter2", "twitter3", "twitter4");
    }

    @Autowired
    private ESUtils esUtils;

    private void assertions(IndexResponse response) {
        assertNotNull(response);
        assertEquals(1, response.getShardInfo().getSuccessful());
        assertTrue(List.of(200, 201).contains(response.status().getStatus()));
    }

    @Order(1)
    @Test
    void testIndexExists() {
        indexNames.forEach(indexName-> {
            if (esUtils.indexExists(indexName)) {
                esUtils.deleteIndexByIndexName(indexName);
                assertFalse(esUtils.indexExists(indexName));
            }
        });
    }

    @Order(3)
    @Test
    void testDeleteIndexByIndexName() {
        String indexName = indexNames.get(0);
        if (esUtils.indexExists(indexName)) {
            AcknowledgedResponse response = esUtils.deleteIndexByIndexName(indexName);
            assertNotNull(response);
            assertTrue(response.isAcknowledged());
            assertFalse(esUtils.indexExists(indexName));
        }
    }

    @Order(5)
    @Test
    void testCreateIndexMappingSource() {
        String jsonSource = "{\n" +
                "  \"properties\": {\n" +
                "    \"message\": {\n" +
                "      \"type\": \"text\"\n" +
                "    }\n" +
                "  }\n" +
                "}";
        CreateIndexResponse response = esUtils.createIndex(indexNames.get(1), 3, 1, jsonSource, "twitter1_alias");
        assertNotNull(response);
        assertTrue(response.isAcknowledged());
    }

    @Order(6)
    @Test
    void testCreateIndexMap() {
        Map message = new HashMap<>();
        message.put("type", "text");
        Map properties = new HashMap<>();
        properties.put("message", message);
        Map mapping = new HashMap<>();
        mapping.put("properties", properties);
        CreateIndexResponse response = esUtils.createIndex(indexNames.get(2), 3, 1, mapping, "twitter2_alias");
        assertNotNull(response);
        assertTrue(response.isAcknowledged());
    }

    @Order(7)
    @Test
    void testCreateIndexBuilder() {
        try {
            XContentBuilder builder = XContentFactory.jsonBuilder();
            builder.startObject();
            {
                builder.startObject("properties");
                {
                    builder.startObject("message");
                    {
                        builder.field("type", "text");
                    }
                    builder.endObject();
                }
                builder.endObject();
            }
            builder.endObject();
            CreateIndexResponse response = esUtils.createIndex(indexNames.get(3), 3, 1, builder, "twitter3_alias");
            assertNotNull(response);
            assertTrue(response.isAcknowledged());
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    @Order(8)
    @Test
    void testCreateIndexSource() {
        String jsonSource = "{\n" +
                "    \"settings\" : {\n" +
                "        \"number_of_shards\" : 1,\n" +
                "        \"number_of_replicas\" : 0\n" +
                "    },\n" +
                "    \"mappings\" : {\n" +
                "        \"properties\" : {\n" +
                "            \"message\" : { \"type\" : \"text\" }\n" +
                "        }\n" +
                "    },\n" +
                "    \"aliases\" : {\n" +
                "        \"twitter4_alias\" : {}\n" +
                "    }\n" +
                "}";
        CreateIndexResponse response = esUtils.createIndex(indexNames.get(4), jsonSource);
        assertNotNull(response);
        assertTrue(response.isAcknowledged());
    }

    @Order(10)
    @Test
    void testSaveIndexString() {
        String jsonString = "{" +
                "\"user\":\"zhangsan\"," +
                "\"postDate\":\"2020-06-30\"," +
                "\"message\":\"trying out Elasticsearch\"," +
                "\"number\":1" +
                "}";
        IndexResponse response = esUtils.saveIndexData(indexNames.get(0), "1", jsonString);
        assertions(response);
    }

    @Order(11)
    @Test
    void testSaveIndexMap() {
        Map jsonMap = new HashMap<>();
        jsonMap.put("user", "lisi");
        jsonMap.put("postDate", new Date());
        jsonMap.put("message", "trying out Elasticsearch");
        IndexResponse response = esUtils.saveIndexData(indexNames.get(0), "2", jsonMap);
        assertions(response);
    }

    @Order(12)
    @Test
    void testSaveIndexBuilder() {
        XContentBuilder builder = null;
        try {
            builder = XContentFactory.jsonBuilder();
            builder.startObject();
            {
                builder.field("user", "wangwu");
                builder.timeField("postDate", new Date());
                builder.field("message", "trying out Elasticsearch");
            }
            builder.endObject();
            IndexResponse response = esUtils.saveIndexData(indexNames.get(0), "3", builder);
            assertions(response);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    @Order(13)
    @Test
    void testSaveIndexJSONObject() {
        JSONObject obj = new JSONObject();
        obj.put("user", "zhaoliu");
        obj.put("postDate", new Date());
        obj.put("message", "trying out Elasticsearch");
        IndexResponse response = esUtils.saveIndexData(indexNames.get(0), "4", obj);
        assertions(response);
    }

    @Order(20)
    @Test
    void testGetIndexDataById() {
        GetResponse getResponse = esUtils.getIndexDataById(indexNames.get(0), "1", new String[]{"message", "*Date"}, Strings.EMPTY_ARRAY, "message");
        assertNotNull(getResponse);
        String message = getResponse.getSource().get("message").toString();
        System.out.println(message);
        assertNotNull(message);
    }

    @Order(21)
    @Test
    void testGetIndexSourceDataById() {
        GetSourceResponse getSourceResponse = esUtils.getIndexSourceDataById(indexNames.get(0), "1", new String[]{"message", "*Date"}, Strings.EMPTY_ARRAY);
        assertNotNull(getSourceResponse);
        String message = getSourceResponse.getSource().get("message").toString();
        System.out.println(message);
        assertNotNull(message);
    }

    @Order(22)
    @Test
    void testAsyncGetIndexDataById() {
        GetResponse getResponse = esUtils.asyncGetIndexDataById(indexNames.get(0), "1", new String[]{"message", "*Date"}, Strings.EMPTY_ARRAY, "message");
        assertNotNull(getResponse);
        String message = getResponse.getSource().get("message").toString();
        System.out.println(message);
        assertNotNull(message);
    }

    @Order(23)
    @Test
    void testAsyncGetIndexSourceDataById() {
        GetSourceResponse getSourceResponse = esUtils.asyncGetIndexSourceDataById(indexNames.get(0), "1", new String[]{"message", "*Date"}, Strings.EMPTY_ARRAY);
        assertNotNull(getSourceResponse);
        String message = getSourceResponse.getSource().get("message").toString();
        System.out.println(message);
        assertNotNull(message);
    }

    @Order(31)
    @Test
    void testUpdateDataByIdAndScript() {
        Map parameters = Collections.singletonMap("count", 4);
        Script inline = new Script(ScriptType.INLINE, "painless",
                "ctx._source.number += params.count", parameters);

        UpdateResponse updateResponse = esUtils.updateDataById(indexNames.get(0), "1", inline);

        assertNotNull(updateResponse);
        assertEquals(1, updateResponse.getShardInfo().getSuccessful());
    }

    @Order(32)
    @Test
    void testUpdateDataByIdAndJsonString() {
        String jsonString = "{" +
                "\"updated\":\"2017-01-01\"," +
                "\"reason\":\"daily update\"" +
                "}";

        UpdateResponse updateResponse = esUtils.updateDataById(indexNames.get(0), "1", jsonString);

        assertNotNull(updateResponse);
        assertEquals(1, updateResponse.getShardInfo().getSuccessful());
    }

    @Order(33)
    @Test
    void testUpdateDataByIdAndXContentBuilder() {
        try {
            XContentBuilder builder = XContentFactory.jsonBuilder();
            builder.startObject();
            {
                builder.timeField("updated", new Date());
                builder.field("reason", "daily update");
            }
            builder.endObject();

            UpdateResponse updateResponse = esUtils.updateDataById(indexNames.get(0), "1", builder);

            assertNotNull(updateResponse);
            assertEquals(1, updateResponse.getShardInfo().getSuccessful());
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    @Order(34)
    @Test
    void testUpdateDataByIdAndJSONObject() {
        JSONObject obj = new JSONObject();
        obj.put("updated", new Date());
        obj.put("reason", "daily update");

        UpdateResponse updateResponse = esUtils.updateDataById(indexNames.get(0), "1", obj);

        assertNotNull(updateResponse);
        assertEquals(1, updateResponse.getShardInfo().getSuccessful());
    }

    @Order(40)
    @ParameterizedTest
    @CsvSource({"posts,1,200"})
    void testDeleteDataById(String indexName, String indexId, Integer version) {
        // current version is lower to the one provided
        DeleteResponse deleteResponse = esUtils.deleteDataById(indexName, indexId, version);

        assertNotNull(deleteResponse);
        assertEquals(1, deleteResponse.getShardInfo().getSuccessful());
    }
}

五、测试结果

E:\jdk\jdk-14.0.1\bin\java.exe -ea -Didea.test.cyclic.buffer.size=1048576 "-javaagent:E:\JetBrains\IntelliJ IDEA 2019.2.3\lib\idea_rt.jar=63703:E:\JetBrains\IntelliJ IDEA 2019.2.3\bin" -Dfile.encoding=UTF-8 -classpath "E:\JetBrains\IntelliJ IDEA 2019.2.3\lib\idea_rt.jar;E:\maven\repository\org\junit\platform\junit-platform-launcher\1.6.2\junit-platform-launcher-1.6.2.jar;E:\maven\repository\org\apiguardian\apiguardian-api\1.1.0\apiguardian-api-1.1.0.jar;E:\maven\repository\org\junit\platform\junit-platform-engine\1.6.2\junit-platform-engine-1.6.2.jar;E:\maven\repository\org\opentest4j\opentest4j\1.2.0\opentest4j-1.2.0.jar;E:\maven\repository\org\junit\platform\junit-platform-commons\1.6.2\junit-platform-commons-1.6.2.jar;E:\JetBrains\IntelliJ IDEA 2019.2.3\plugins\junit\lib\junit5-rt.jar;E:\JetBrains\IntelliJ IDEA 2019.2.3\plugins\junit\lib\junit-rt.jar;F:\IdeaProjects\my-jooq\out\test\classes;F:\IdeaProjects\my-jooq\out\production\classes;F:\IdeaProjects\my-jooq\out\production\resources;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-data-jpa\2.3.1.RELEASE\5531a4cbd506f13a0b4483ed73c2e75a03d8da46\spring-boot-starter-data-jpa-2.3.1.RELEASE.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-jooq\2.3.1.RELEASE\56972c0f55ef078439045d8548c115cefaeda0f2\spring-boot-starter-jooq-2.3.1.RELEASE.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-test\2.3.1.RELEASE\aa800443c878a2ca6615cf13490286757195941c\spring-boot-starter-test-2.3.1.RELEASE.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-web\2.3.1.RELEASE\555c4f90141cdbc7637145e413bca0d622ba6796\spring-boot-starter-web-2.3.1.RELEASE.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.postgresql\postgresql\42.2.12\1ed5b5f16a67f312a50d420e8bcb7d30b40b033d\postgresql-42.2.12.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.flywaydb\flyway-core\6.4.0\a9a4101b87df144d928491220829b5e8b51d4b5f\flyway-core-6.4.0.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.jooq\jooq-codegen\3.13.2\3321b6c25c2f16361e1435760a843d92a63a80e7\jooq-codegen-3.13.2.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.jooq\jooq-meta\3.13.2\5fbf793257121dd922dd8b5e7bca2bdcda8e9495\jooq-meta-3.13.2.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.springframework\spring-tx\5.2.5.RELEASE\29c07e0d3013ba8fcfa760b2fab457bea19d89bc\spring-tx-5.2.5.RELEASE.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.reflections\reflections\0.9.12\1c9d44c563eebe9b8a3afebd29ed5c4646db800c\reflections-0.9.12.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\net.logstash.logback\logstash-logback-encoder\6.3\79468d3566f9cf837fa3805dd2de057002d4ea04\logstash-logback-encoder-6.3.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.elasticsearch.client\elasticsearch-rest-high-level-client\7.8.0\67055e932c831595575463ef652c8d8ddaae2d28\elasticsearch-rest-high-level-client-7.8.0.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.elasticsearch.client\elasticsearch-rest-client\7.8.0\ab28f6110bdc7d2ec886e1d6ff29a6c8ee30b883\elasticsearch-rest-client-7.8.0.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.elasticsearch\elasticsearch\7.8.0\e87ef417087e4edcb1955d9239fcbc07413160c5\elasticsearch-7.8.0.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\com.google.guava\guava\29.0-jre\801142b4c3d0f0770dd29abea50906cacfddd447\guava-29.0-jre.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.json\json\20200518\41a767de4bde8f01d53856b905c49b2db8862f13\json-20200518.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.junit.jupiter\junit-jupiter\5.7.0-M1\6f6a6b7131a99190737ccb6b82d6e8295abb7cb1\junit-jupiter-5.7.0-M1.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-aop\2.3.1.RELEASE\f42e23091d29bde8d1356e45cf13ad32dae51437\spring-boot-starter-aop-2.3.1.RELEASE.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-jdbc\2.3.1.RELEASE\800b64e76588ea88761ad9108cde762204805d66\spring-boot-starter-jdbc-2.3.1.RELEASE.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.springframework.data\spring-data-jpa\2.3.1.RELEASE\1b5e106add569913f0c776aca62f85d8e9ca8cee\spring-data-jpa-2.3.1.RELEASE.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\jakarta.transaction\jakarta.transaction-api\1.3.3\c4179d48720a1e87202115fbed6089bdc4195405\jakarta.transaction-api-1.3.3.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\jakarta.persistence\jakarta.persistence-api\2.2.3\8f6ea5daedc614f07a3654a455660145286f024e\jakarta.persistence-api-2.2.3.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.hibernate\hibernate-core\5.4.17.Final\3b90ecf6fe93a27a27de9671c9fb25d03ba3def7\hibernate-core-5.4.17.Final.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.springframework\spring-aspects\5.2.7.RELEASE\eb48f4ae3e1525179e1ccd10c0e09cfe5c27b8bb\spring-aspects-5.2.7.RELEASE.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\jakarta.xml.bind\jakarta.xml.bind-api\2.3.3\48e3b9cfc10752fba3521d6511f4165bea951801\jakarta.xml.bind-api-2.3.3.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\jakarta.activation\jakarta.activation-api\1.2.2\99f53adba383cb1bf7c3862844488574b559621f\jakarta.activation-api-1.2.2.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.jooq\jooq\3.13.2\f356d70330b2aaa5f55858c192927f3e0d1bf89c\jooq-3.13.2.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter\2.3.1.RELEASE\e0d28696fea064578cb01da346232284f922eba4\spring-boot-starter-2.3.1.RELEASE.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-test-autoconfigure\2.3.1.RELEASE\79667206307c09a4576e8729359b8637e498cb6d\spring-boot-test-autoconfigure-2.3.1.RELEASE.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-test\2.3.1.RELEASE\d103039c2def2b11fe55e6c362f7dd7b06e4d41b\spring-boot-test-2.3.1.RELEASE.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.springframework\spring-test\5.2.7.RELEASE\b2ca8c5d6f7a07bc3d62d7e08c99f544478bdd65\spring-test-5.2.7.RELEASE.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.springframework\spring-core\5.2.7.RELEASE\56e14a3a5e2813534b5db2da1502cd58ab5bc61d\spring-core-5.2.7.RELEASE.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\com.jayway.jsonpath\json-path\2.4.0\765a4401ceb2dc8d40553c2075eb80a8fa35c2ae\json-path-2.4.0.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.assertj\assertj-core\3.16.1\6e772120aff69ca3d1583b3d1b36b7529de43ba1\assertj-core-3.16.1.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.hamcrest\hamcrest\2.2\1820c0968dba3a11a1b30669bb1f01978a91dedc\hamcrest-2.2.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.mockito\mockito-junit-jupiter\3.3.3\1176ce43cf773e11a5a318ff04e57e55f9187347\mockito-junit-jupiter-3.3.3.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.mockito\mockito-core\3.3.3\4878395d4e63173f3825e17e5e0690e8054445f1\mockito-core-3.3.3.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.skyscreamer\jsonassert\1.5.0\6c9d5fe2f59da598d9aefc1cfc6528ff3cf32df3\jsonassert-1.5.0.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.xmlunit\xmlunit-core\2.7.0\4d014eac96329c70175116b185749765cee0aad5\xmlunit-core-2.7.0.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-json\2.3.1.RELEASE\8342003919c7e5a2470072595ea190cb8a9552c0\spring-boot-starter-json-2.3.1.RELEASE.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-tomcat\2.3.1.RELEASE\5b599d0da04e724479c22daa47f9bfd62533a2e9\spring-boot-starter-tomcat-2.3.1.RELEASE.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.springframework\spring-webmvc\5.2.7.RELEASE\dcd97bcb0a2aa33f272b0031e4771134e327d942\spring-webmvc-5.2.7.RELEASE.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.springframework\spring-web\5.2.7.RELEASE\50a27c77e1731f3b7af5c2ae7caf6fe59bcc309\spring-web-5.2.7.RELEASE.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.springframework\spring-beans\5.2.7.RELEASE\5465ab17688ed62254fdef411cf883fd5c3b77a\spring-beans-5.2.7.RELEASE.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.javassist\javassist\3.26.0-GA\bb2890849968d8d8311ffba8c37b0ce16ce284dc\javassist-3.26.0-GA.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-databind\2.11.0\8f5aaf3878b0647ff3a16610af53b1a5c05d9f15\jackson-databind-2.11.0.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.elasticsearch.plugin\mapper-extras-client\7.8.0\6f852909704bb95254700253cce524ddbec82518\mapper-extras-client-7.8.0.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.elasticsearch.plugin\parent-join-client\7.8.0\f6a647512b571b91e8f70c4f7db322e1b8bc5f32\parent-join-client-7.8.0.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.elasticsearch.plugin\aggs-matrix-stats-client\7.8.0\3a5f8ffae973a6d161e4db4276d47b0b79f69f92\aggs-matrix-stats-client-7.8.0.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.elasticsearch.plugin\rank-eval-client\7.8.0\e85808baa79a93914b1a5ff8e69fbbde5c74cfb2\rank-eval-client-7.8.0.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.elasticsearch.plugin\lang-mustache-client\7.8.0\b1d124f3bf24a29dc3475930719c397c7f798ae9\lang-mustache-client-7.8.0.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.apache.httpcomponents\httpclient\4.5.12\4023a2a80b64c25926911faf350b50cd2a29220f\httpclient-4.5.12.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.apache.httpcomponents\httpcore\4.4.13\853b96d3afbb7bf8cc303fe27ee96836a10c1834\httpcore-4.4.13.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.apache.httpcomponents\httpasyncclient\4.1.4\f3a3240681faae3fa46b573a4c7e50cec9db0d86\httpasyncclient-4.1.4.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.apache.httpcomponents\httpcore-nio\4.4.13\3f897ace4d7f10f0ea6a58f524a3b105dd483653\httpcore-nio-4.4.13.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\commons-codec\commons-codec\1.14\3cb1181b2141a7e752f5bdc998b7ef1849f726cf\commons-codec-1.14.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.elasticsearch\elasticsearch-x-content\7.8.0\9cde4498a95ba2fddcc9986d2cc09b9fd8e3634\elasticsearch-x-content-7.8.0.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.elasticsearch\elasticsearch-cli\7.8.0\7f3df9c96fdc1e109bb1454618f4ad055d436998\elasticsearch-cli-7.8.0.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.elasticsearch\elasticsearch-core\7.8.0\f0e483035253f7da1d21586198adab2bf03fc0c9\elasticsearch-core-7.8.0.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.elasticsearch\elasticsearch-secure-sm\7.8.0\a5e2cff8506f9ef27534e35d3e75409477071dda\elasticsearch-secure-sm-7.8.0.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.elasticsearch\elasticsearch-geo\7.8.0\63b2ff3a13e4678a046e427f02ae7130533ec0e5\elasticsearch-geo-7.8.0.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.apache.lucene\lucene-core\8.5.1\24212de43c19269f5211f3e79eb2f414c4a0254b\lucene-core-8.5.1.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.apache.lucene\lucene-analyzers-common\8.5.1\704685ddf536e1af4da025b6e6f4e50b9846ef18\lucene-analyzers-common-8.5.1.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.apache.lucene\lucene-backward-codecs\8.5.1\ab12c24a7c33ef5dfe8b57f17f67fec4a3fee1c\lucene-backward-codecs-8.5.1.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.apache.lucene\lucene-grouping\8.5.1\4404f3ff6341b7518843d09141df743bf91a8284\lucene-grouping-8.5.1.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.apache.lucene\lucene-highlighter\8.5.1\142f5f249aa0803f8283a3d08615e37a56f40e8a\lucene-highlighter-8.5.1.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.apache.lucene\lucene-join\8.5.1\b0a48846662fc504bd7796b5506dad94981fca08\lucene-join-8.5.1.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.apache.lucene\lucene-memory\8.5.1\ba9e24b90323aacc98a4ac661ac34bfbf0ed66d8\lucene-memory-8.5.1.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.apache.lucene\lucene-misc\8.5.1\a0418e9bc16fc876448accb828a6ca38ed63d4a8\lucene-misc-8.5.1.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.apache.lucene\lucene-queries\8.5.1\269c67a4ee9b806cfdacddc211744243cbcbd127\lucene-queries-8.5.1.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.apache.lucene\lucene-queryparser\8.5.1\ee5ba0e07a178a32987b0a92da149f2104e26dd9\lucene-queryparser-8.5.1.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.apache.lucene\lucene-sandbox\8.5.1\f1461680109e499d8c58dcaf5d314aeeef41d99a\lucene-sandbox-8.5.1.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.apache.lucene\lucene-spatial-extras\8.5.1\eece1ef3f919634c79b9ae9d99264ac9efa4276c\lucene-spatial-extras-8.5.1.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.apache.lucene\lucene-spatial3d\8.5.1\a8fb2771ac562d60a3c945a4cef0e3742c390329\lucene-spatial3d-8.5.1.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.apache.lucene\lucene-suggest\8.5.1\b5613f4995836fd9edae5925ed38559460721492\lucene-suggest-8.5.1.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\com.carrotsearch\hppc\0.8.1\ffc7ba8f289428b9508ab484b8001dea944ae603\hppc-0.8.1.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\joda-time\joda-time\2.10.4\8c10bb8815109067ce3c91a8e547b5a52e8a1c1a\joda-time-2.10.4.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\com.tdunning\t-digest\3.2\2ab94758b0276a8a26102adf8d528cf6d0567b9a\t-digest-3.2.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.hdrhistogram\HdrHistogram\2.1.9\e4631ce165eb400edecfa32e03d3f1be53dee754\HdrHistogram-2.1.9.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.apache.logging.log4j\log4j-api\2.13.3\ec1508160b93d274b1add34419b897bae84c6ca9\log4j-api-2.13.3.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.elasticsearch\jna\4.5.1\da10908ae23dc59b19dc258e63aea1c44621dc3a\jna-4.5.1.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\com.google.guava\failureaccess\1.0.1\1dcf1de382a0bf95a3d8b0849546c88bac1292c9\failureaccess-1.0.1.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\com.google.guava\listenablefuture\9999.0-empty-to-avoid-conflict-with-guava\b421526c5f297295adef1c886e5246c39d4ac629\listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\com.google.code.findbugs\jsr305\3.0.2\25ea2e8b0c338a877313bd4672d3fe056ea78f0d\jsr305-3.0.2.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.checkerframework\checker-qual\2.11.1\8c43bf8f99b841d23aadda6044329dad9b63c185\checker-qual-2.11.1.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\com.google.errorprone\error_prone_annotations\2.3.4\dac170e4594de319655ffb62f41cbd6dbb5e601e\error_prone_annotations-2.3.4.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\com.google.j2objc\j2objc-annotations\1.3\ba035118bc8bac37d7eff77700720999acd9986d\j2objc-annotations-1.3.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.junit.jupiter\junit-jupiter-params\5.6.2\f2a64a42cf73077062c2386db0598062b7480d91\junit-jupiter-params-5.6.2.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.junit.jupiter\junit-jupiter-api\5.6.2\c9ba885abfe975cda123bf6f8f0a69a1b46956d0\junit-jupiter-api-5.6.2.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.springframework\spring-aop\5.2.7.RELEASE\9cf69f8e888091684c05f0a287bb638502e90725\spring-aop-5.2.7.RELEASE.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.aspectj\aspectjweaver\1.9.5\1740dc9140103b796d1722668805fd4cf852780c\aspectjweaver-1.9.5.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.springframework\spring-jdbc\5.2.7.RELEASE\847d31c90479a34e4e1fe7eeeb47ac89adce3438\spring-jdbc-5.2.7.RELEASE.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\com.zaxxer\HikariCP\3.4.5\aa1a2c00aae8e4ba8308e19940711bb9525b103d\HikariCP-3.4.5.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.springframework\spring-orm\5.2.7.RELEASE\32a76d825d8782ff278abe124ded9620444b4a74\spring-orm-5.2.7.RELEASE.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.springframework\spring-context\5.2.7.RELEASE\7fd9c4ea311a5d9ab92770be7fc93cc53db334f9\spring-context-5.2.7.RELEASE.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.springframework.data\spring-data-commons\2.3.1.RELEASE\5ae66c24c223315d5b31a45590d293e9145c18e9\spring-data-commons-2.3.1.RELEASE.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.slf4j\slf4j-api\1.7.30\b5a4b6d16ab13e34a88fae84c35cd5d68cac922c\slf4j-api-1.7.30.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.glassfish.jaxb\jaxb-runtime\2.3.3\c46b68a6e3a2d84ba4eb14c6a8a1a9a7be4048bc\jaxb-runtime-2.3.3.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\antlr\antlr\2.7.7\83cd2cd674a217ade95a4bb83a8a14f351f48bd0\antlr-2.7.7.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\net.bytebuddy\byte-buddy\1.10.11\16ac7e0d4afef10ac30db377e8151aff66a90e1c\byte-buddy-1.10.11.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\com.fasterxml\classmate\1.5.1\3fe0bed568c62df5e89f4f174c101eab25345b6c\classmate-1.5.1.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.hibernate.common\hibernate-commons-annotations\5.1.0.Final\700aeedc4a2089816621948f0379e17cbd17d5db\hibernate-commons-annotations-5.1.0.Final.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.jboss.logging\jboss-logging\3.4.1.Final\40fd4d696c55793e996d1ff3c475833f836c2498\jboss-logging-3.4.1.Final.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.jboss\jandex\2.1.3.Final\cd56603e39eb1421560b71daa584348ecfd9e0b8\jandex-2.1.3.Final.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.dom4j\dom4j\2.1.3\a75914155a9f5808963170ec20653668a2ffd2fd\dom4j-2.1.3.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.reactivestreams\reactive-streams\1.0.3\d9fb7a7926ffa635b3dcaa5049fb2bfa25b3e7d0\reactive-streams-1.0.3.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\javax.xml.bind\jaxb-api\2.3.1\8531ad5ac454cc2deb9d4d32c40c4d7451939b5d\jaxb-api-2.3.1.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-autoconfigure\2.3.1.RELEASE\6d679d6ba26235a0e81ca1d58f9c1024d9427411\spring-boot-autoconfigure-2.3.1.RELEASE.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.springframework.boot\spring-boot\2.3.1.RELEASE\ce8d8b6838ecceb68962b975b18682f4237ccf71\spring-boot-2.3.1.RELEASE.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-logging\2.3.1.RELEASE\3f242a91ffddf7485fde1367e1354c7e13024c8\spring-boot-starter-logging-2.3.1.RELEASE.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\jakarta.annotation\jakarta.annotation-api\1.3.5\59eb84ee0d616332ff44aba065f3888cf002cd2d\jakarta.annotation-api-1.3.5.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.yaml\snakeyaml\1.26\a78a8747147d2c5807683e76ec2b633e95c14fe9\snakeyaml-1.26.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.springframework\spring-jcl\5.2.7.RELEASE\72282e1f89c58284632220437b5a1e8066c53d7d\spring-jcl-5.2.7.RELEASE.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\net.minidev\json-smart\2.3\7396407491352ce4fa30de92efb158adb76b5b\json-smart-2.3.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\net.bytebuddy\byte-buddy-agent\1.10.11\351d1003e193f5ae0be423bda4b4ac084f84e2b1\byte-buddy-agent-1.10.11.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.objenesis\objenesis\2.6\639033469776fd37c08358c6b92a4761feb2af4b\objenesis-2.6.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\com.fasterxml.jackson.datatype\jackson-datatype-jdk8\2.11.0\cca91d6375258fd7ff2a6abb7bf91eef492bd606\jackson-datatype-jdk8-2.11.0.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\com.fasterxml.jackson.datatype\jackson-datatype-jsr310\2.11.0\168b2d0e11478b9f0a1bfccd62d6b5e8547b1e6f\jackson-datatype-jsr310-2.11.0.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\com.fasterxml.jackson.module\jackson-module-parameter-names\2.11.0\950a1e9a7c1093e7ffd92b216d5a0667f1e39058\jackson-module-parameter-names-2.11.0.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.glassfish\jakarta.el\3.0.3\dab46ee1ee23f7197c13d7c40fce14817c9017df\jakarta.el-3.0.3.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.apache.tomcat.embed\tomcat-embed-websocket\9.0.36\33fa5038aa66be6e9cc188000c2188aa4dd33c85\tomcat-embed-websocket-9.0.36.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.apache.tomcat.embed\tomcat-embed-core\9.0.36\cf6574dd9c4764e60c548b69da52fc07a5a0a9bd\tomcat-embed-core-9.0.36.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.springframework\spring-expression\5.2.7.RELEASE\c98d7b10f959f9bedfbbbd4d723cf7a1f17a1f71\spring-expression-5.2.7.RELEASE.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-annotations\2.11.0\c626020ae55d19c690d25cb51c1532ba76e5890f\jackson-annotations-2.11.0.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-core\2.11.0\f84302e14648f9f63c0c73951054aeb2ff0b810a\jackson-core-2.11.0.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\com.github.spullara.mustache.java\compiler\0.9.6\1b8707299c34406ed0ba40bbf8513352ac4765c9\compiler-0.9.6.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\com.fasterxml.jackson.dataformat\jackson-dataformat-cbor\2.11.0\3d9b7ba55da2883823b34eb9a33f186688098400\jackson-dataformat-cbor-2.11.0.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\com.fasterxml.jackson.dataformat\jackson-dataformat-smile\2.11.0\a232adc9dc1dfa5ba97aa6b065e556c2872614b0\jackson-dataformat-smile-2.11.0.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\com.fasterxml.jackson.dataformat\jackson-dataformat-yaml\2.11.0\f5314fe164fc1e3bdcaf20fe0851759917312d9e\jackson-dataformat-yaml-2.11.0.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\net.sf.jopt-simple\jopt-simple\5.0.2\98cafc6081d5632b61be2c9e60650b64ddbc637c\jopt-simple-5.0.2.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.apiguardian\apiguardian-api\1.1.0\fc9dff4bb36d627bdc553de77e1f17efd790876c\apiguardian-api-1.1.0.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.junit.platform\junit-platform-commons\1.6.2\7644a14b329e76b5fe487628b50fb5eab6ba7d26\junit-platform-commons-1.6.2.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.opentest4j\opentest4j\1.2.0\28c11eb91f9b6d8e200631d46e20a7f407f2a046\opentest4j-1.2.0.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.glassfish.jaxb\txw2\2.3.3\12f70b0ea4fc1ad45315e842f63f7c9a46f46530\txw2-2.3.3.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\com.sun.istack\istack-commons-runtime\3.0.11\4293b5f4e4e89d598f62bb2ba73b32132e7c3a27\istack-commons-runtime-3.0.11.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\javax.activation\javax.activation-api\1.2.0\85262acf3ca9816f9537ca47d5adeabaead7cb16\javax.activation-api-1.2.0.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.apache.logging.log4j\log4j-to-slf4j\2.13.3\966f6fd1af4959d6b12bfa880121d4a2b164f857\log4j-to-slf4j-2.13.3.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\ch.qos.logback\logback-classic\1.2.3\7c4f3c474fb2c041d8028740440937705ebb473a\logback-classic-1.2.3.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.slf4j\jul-to-slf4j\1.7.30\d58bebff8cbf70ff52b59208586095f467656c30\jul-to-slf4j-1.7.30.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\net.minidev\accessors-smart\1.2\c592b500269bfde36096641b01238a8350f8aa31\accessors-smart-1.2.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\ch.qos.logback\logback-core\1.2.3\864344400c3d4d92dfeb0a305dc87d953677c03c\logback-core-1.2.3.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.ow2.asm\asm\5.0.4\da08b8cce7bbf903602a25a3a163ae252435795\asm-5.0.4.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.junit.jupiter\junit-jupiter-engine\5.6.2\c0833bd6de29dd77f8d071025b97b8b434308cd3\junit-jupiter-engine-5.6.2.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.junit.platform\junit-platform-engine\1.6.2\1752cad2579e20c2b224602fe846fc660fb35805\junit-platform-engine-1.6.2.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\com.sun.activation\jakarta.activation\1.2.2\74548703f9851017ce2f556066659438019e7eb5\jakarta.activation-1.2.2.jar" com.intellij.rt.junit.JUnitStarter -ideVersion5 -junit5 com.zsx.utils.ESUtilsTest
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
09:38:08.411 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating CacheAwareContextLoaderDelegate from class [org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate]
09:38:08.420 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating BootstrapContext using constructor [public org.springframework.test.context.support.DefaultBootstrapContext(java.lang.Class,org.springframework.test.context.CacheAwareContextLoaderDelegate)]
09:38:08.439 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating TestContextBootstrapper for test class [com.zsx.utils.ESUtilsTest] from class [org.springframework.boot.test.context.SpringBootTestContextBootstrapper]
09:38:08.458 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Neither @ContextConfiguration nor @ContextHierarchy found for test class [com.zsx.utils.ESUtilsTest], using SpringBootContextLoader
09:38:08.460 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [com.zsx.utils.ESUtilsTest]: class path resource [com/zsx/utils/ESUtilsTest-context.xml] does not exist
09:38:08.461 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [com.zsx.utils.ESUtilsTest]: class path resource [com/zsx/utils/ESUtilsTestContext.groovy] does not exist
09:38:08.461 [main] INFO org.springframework.test.context.support.AbstractContextLoader - Could not detect default resource locations for test class [com.zsx.utils.ESUtilsTest]: no resource found for suffixes {-context.xml, Context.groovy}.
09:38:08.461 [main] INFO org.springframework.test.context.support.AnnotationConfigContextLoaderUtils - Could not detect default configuration classes for test class [com.zsx.utils.ESUtilsTest]: ESUtilsTest does not declare any static, non-private, non-final, nested classes annotated with @Configuration.
09:38:08.499 [main] DEBUG org.springframework.test.context.support.ActiveProfilesUtils - Could not find an 'annotation declaring class' for annotation type [org.springframework.test.context.ActiveProfiles] and class [com.zsx.utils.ESUtilsTest]
09:38:08.552 [main] DEBUG org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider - Identified candidate component class: file [F:\IdeaProjects\my-jooq\out\production\classes\com\zsx\MyJooqApplication.class]
09:38:08.553 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Found @SpringBootConfiguration com.zsx.MyJooqApplication for test class com.zsx.utils.ESUtilsTest
09:38:08.645 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - @TestExecutionListeners is not present for class [com.zsx.utils.ESUtilsTest]: using defaults.
09:38:08.646 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Loaded default TestExecutionListener class names from location [META-INF/spring.factories]: [org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener, org.springframework.boot.test.autoconfigure.webservices.client.MockWebServiceServerTestExecutionListener, org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener, org.springframework.test.context.web.ServletTestExecutionListener, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener, org.springframework.test.context.support.DependencyInjectionTestExecutionListener, org.springframework.test.context.support.DirtiesContextTestExecutionListener, org.springframework.test.context.transaction.TransactionalTestExecutionListener, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener, org.springframework.test.context.event.EventPublishingTestExecutionListener]
09:38:08.658 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Using TestExecutionListeners: [org.springframework.test.context.web.ServletTestExecutionListener@2bb3058, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener@7a362b6b, org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener@60df60da, org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener@5a2d131d, org.springframework.test.context.support.DirtiesContextTestExecutionListener@14fc1f0, org.springframework.test.context.transaction.TransactionalTestExecutionListener@4ae9cfc1, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener@512baff6, org.springframework.test.context.event.EventPublishingTestExecutionListener@632ceb35, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener@1c93f6e1, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener@1800a575, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener@1458ed9c, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener@10a9d961, org.springframework.boot.test.autoconfigure.webservices.client.MockWebServiceServerTestExecutionListener@130e116b, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener@e383572]
09:38:08.661 [main] DEBUG org.springframework.test.context.support.AbstractDirtiesContextTestExecutionListener - Before test class: context [DefaultTestContext@56928307 testClass = ESUtilsTest, testInstance = [null], testMethod = [null], testException = [null], mergedContextConfiguration = [WebMergedContextConfiguration@3899782c testClass = ESUtilsTest, locations = '{}', classes = '{class com.zsx.MyJooqApplication}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true}', contextCustomizers = set[org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizerFactory$Customizer@10163d6, org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@6c130c45, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@6d3a388c, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@1e683a3e, org.springframework.boot.test.context.SpringBootTestArgs@1], resourceBasePath = 'src/main/webapp', contextLoader = 'org.springframework.boot.test.context.SpringBootContextLoader', parent = [null]], attributes = map['org.springframework.test.context.web.ServletTestExecutionListener.activateListener' -> true]], class annotated with @DirtiesContext [false] with mode [null].
09:38:08.684 [main] DEBUG org.springframework.test.context.support.TestPropertySourceUtils - Adding inlined properties to environment: {spring.jmx.enabled=false, org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true}

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.3.1.RELEASE)

2020-07-02 09:38:11.431  INFO 1648 --- [           main] com.zsx.utils.ESUtilsTest                : Starting ESUtilsTest on zsx with PID 1648 (started by 18273 in F:\IdeaProjects\my-jooq)
2020-07-02 09:38:11.432  INFO 1648 --- [           main] com.zsx.utils.ESUtilsTest                : No active profile set, falling back to default profiles: default
2020-07-02 09:38:11.960  INFO 1648 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFERRED mode.
2020-07-02 09:38:11.983  INFO 1648 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 16ms. Found 0 JPA repository interfaces.
2020-07-02 09:38:12.460  INFO 1648 --- [           main] o.f.c.internal.license.VersionPrinter    : Flyway Community Edition 6.4.0 by Redgate
2020-07-02 09:38:12.464  WARN 1648 --- [           main] com.zaxxer.hikari.HikariConfig           : HikariPool-1 - idleTimeout has been set but has no effect because the pool is operating as a fixed size pool.
2020-07-02 09:38:12.465  INFO 1648 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...
2020-07-02 09:38:12.535  INFO 1648 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Start completed.
2020-07-02 09:38:12.558  INFO 1648 --- [           main] o.f.c.internal.database.DatabaseFactory  : Database: jdbc:postgresql://127.0.0.1:5432/my-jooq (PostgreSQL 12.0)
2020-07-02 09:38:12.583  INFO 1648 --- [           main] o.f.core.internal.command.DbValidate     : Successfully validated 2 migrations (execution time 00:00.011s)
2020-07-02 09:38:12.587  INFO 1648 --- [           main] o.f.core.internal.command.DbMigrate      : Current version of schema "jooq": 1
2020-07-02 09:38:12.588  INFO 1648 --- [           main] o.f.core.internal.command.DbMigrate      : Schema "jooq" is up to date. No migration necessary.
2020-07-02 09:38:12.680  INFO 1648 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2020-07-02 09:38:12.741  INFO 1648 --- [         task-1] o.hibernate.jpa.internal.util.LogHelper  : HHH000204: Processing PersistenceUnitInfo [name: default]
2020-07-02 09:38:12.799  INFO 1648 --- [         task-1] org.hibernate.Version                    : HHH000412: Hibernate ORM core version 5.4.17.Final
2020-07-02 09:38:12.930  INFO 1648 --- [         task-1] o.hibernate.annotations.common.Version   : HCANN000001: Hibernate Commons Annotations {5.1.0.Final}
2020-07-02 09:38:13.036  INFO 1648 --- [         task-1] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.PostgreSQL10Dialect
2020-07-02 09:38:13.214  INFO 1648 --- [         task-1] o.h.e.t.j.p.i.JtaPlatformInitiator       : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
2020-07-02 09:38:13.222  INFO 1648 --- [         task-1] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2020-07-02 09:38:13.235  WARN 1648 --- [           main] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
2020-07-02 09:38:13.901  INFO 1648 --- [           main] DeferredRepositoryInitializationListener : Triggering deferred initialization of Spring Data repositories…
2020-07-02 09:38:13.902  INFO 1648 --- [           main] DeferredRepositoryInitializationListener : Spring Data repositories initialized!
2020-07-02 09:38:13.909  INFO 1648 --- [           main] com.zsx.utils.ESUtilsTest                : Started ESUtilsTest in 5.218 seconds (JVM running for 5.971)





















trying out Elasticsearch


trying out Elasticsearch


{"_index":"posts","_type":"_doc","_id":"1","_version":1,"_seq_no":0,"_primary_term":1,"found":true,"_source":{"postDate":"2020-06-30","message":"trying out Elasticsearch"}}
trying out Elasticsearch


{postDate=2020-06-30, message=trying out Elasticsearch}
trying out Elasticsearch











2020-07-02 09:38:16.513  INFO 1648 --- [extShutdownHook] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2020-07-02 09:38:16.515  INFO 1648 --- [extShutdownHook] o.s.s.concurrent.ThreadPoolTaskExecutor  : Shutting down ExecutorService 'applicationTaskExecutor'
2020-07-02 09:38:16.516  INFO 1648 --- [extShutdownHook] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown initiated...
2020-07-02 09:38:16.523  INFO 1648 --- [extShutdownHook] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown completed.

Process finished with exit code 0

springboot整合es7.8_第1张图片

到此整合结束

你可能感兴趣的:(springboot,elastic,stack)