diff --git a/.github/workflows/ci-elasticsearch.yml b/.github/workflows/ci-elasticsearch.yml index 765a10b8ff3..d1c5206809c 100644 --- a/.github/workflows/ci-elasticsearch.yml +++ b/.github/workflows/ci-elasticsearch.yml @@ -26,6 +26,9 @@ jobs: - major: 7.x image: 7.14.0 distribution: elasticsearch + - major: 8.x + image: 8.8.0 + distribution: elasticsearch name: ${{ matrix.version.distribution }} ${{ matrix.version.major }} steps: - name: Harden Runner diff --git a/pkg/es/wrapper/wrapper.go b/pkg/es/wrapper/wrapper.go index 9df3a251857..47a31011f98 100644 --- a/pkg/es/wrapper/wrapper.go +++ b/pkg/es/wrapper/wrapper.go @@ -66,7 +66,7 @@ func (c ClientWrapper) Index() es.IndexService { // Search calls this function to internal client. func (c ClientWrapper) Search(indices ...string) es.SearchService { searchService := c.client.Search(indices...) - if c.esVersion == 7 { + if c.esVersion >= 7 { searchService = searchService.RestTotalHitsAsInt(true) } return WrapESSearchService(searchService) @@ -75,7 +75,7 @@ func (c ClientWrapper) Search(indices ...string) es.SearchService { // MultiSearch calls this function to internal client. func (c ClientWrapper) MultiSearch() es.MultiSearchService { multiSearchService := c.client.MultiSearch() - if c.esVersion == 7 { + if c.esVersion >= 7 { multiSearchService = multiSearchService.RestTotalHitsAsInt(true) } return WrapESMultiSearchService(multiSearchService) @@ -167,7 +167,7 @@ func (i IndexServiceWrapper) Index(index string) es.IndexService { // Type calls this function to internal service. func (i IndexServiceWrapper) Type(typ string) es.IndexService { - if i.esVersion == 7 { + if i.esVersion >= 7 { return WrapESIndexService(i.bulkIndexReq, i.bulkService, i.esVersion) } return WrapESIndexService(i.bulkIndexReq.Type(typ), i.bulkService, i.esVersion) diff --git a/scripts/es-integration-test.sh b/scripts/es-integration-test.sh index ce3b4c30f0b..054c9a63b28 100755 --- a/scripts/es-integration-test.sh +++ b/scripts/es-integration-test.sh @@ -27,8 +27,13 @@ setup_es() { --env "http.host=0.0.0.0" --env "transport.host=127.0.0.1" --env "xpack.security.enabled=false" - --env "xpack.monitoring.enabled=false" ) + local major_version=${tag%%.*} + if (( major_version < 8 )); then + params+=( + --env "xpack.monitoring.enabled=false" + ) + fi local cid=$(docker run ${params[@]} ${image}:${tag}) echo ${cid} }