Skip to content

Commit

Permalink
[8.9] Bump Elasticsearch apis (#693)
Browse files Browse the repository at this point in the history
* Typedapi: Add changelog for future release

* bump 8.9.0

* API: Update typed API for Elasticsearch v8.9.0 (26d0e20)

* Tests: reflect typedapi changes

* API: Update API for Elasticsearch v8.9.0 (26ca704)

* fixup! API: Update typed API for Elasticsearch v8.9.0 (26d0e20)
  • Loading branch information
Anaethelion authored Jul 7, 2023
1 parent d4f29a0 commit d279808
Show file tree
Hide file tree
Showing 3,276 changed files with 53,897 additions and 16,725 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
2 changes: 1 addition & 1 deletion .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ steps:
provider: "gcp"
env:
TEST_SUITE: "{{ matrix.suite }}"
STACK_VERSION: 8.8.0-SNAPSHOT
STACK_VERSION: 8.9.0-SNAPSHOT
WORKSPACE: /tmp/go-elasticsearch
matrix:
setup:
Expand Down
2 changes: 1 addition & 1 deletion .ci/test-matrix.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---

STACK_VERSION:
- 8.8.0-SNAPSHOT
- 8.9.0-SNAPSHOT

GO_VERSION:
- 1-alpine
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ on:
branches:
- github-actions
- main
- 8.5
- 8.9
- 7.17
pull_request:
branches:
- main
- 8.5
- 8.9
- 7.17

env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ on:

env:
GITHUB_ACTIONS: true
ELASTICSEARCH_VERSION: elasticsearch:8.3.0-SNAPSHOT
ELASTICSEARCH_VERSION: elasticsearch:8.9.0-SNAPSHOT

jobs:
test:
Expand Down
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
# 8.9.0

## Typed API

* Propagated request fields towards the endpoint for ease of access, taking priority over same-name query string fields.
* Added a stub for Do methods on endpoints that only support a boolean response such as `core.exists`.
* NDJSON endpoints support with custom serialization and helpers for specific like `core.bulk`.
* Link to endpoints documentation in API index to better display and easy of use.

# 8.8.2

## Typed API

* Fixed deserialization for `Suggest` in search responses.
* Fixed double-quoted strings in deserialization for unions normalized as string. #684
* Fixed handling of `core.Get` response when the index did not exist. #678

# 8.7.0

## API
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
SHELL := /bin/bash

ELASTICSEARCH_DEFAULT_BUILD_VERSION = "8.8.0-SNAPSHOT"
ELASTICSEARCH_DEFAULT_BUILD_VERSION = "8.9.0-SNAPSHOT"

##@ Test
test-unit: ## Run unit tests
Expand Down
46 changes: 22 additions & 24 deletions elasticsearch_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import (
"errors"
"fmt"
"github.com/elastic/go-elasticsearch/v8/typedapi/core/search"
"github.com/elastic/go-elasticsearch/v8/typedapi/indices/create"
"github.com/elastic/go-elasticsearch/v8/typedapi/some"
"github.com/elastic/go-elasticsearch/v8/typedapi/types"
"github.com/elastic/go-elasticsearch/v8/typedapi/types/enums/refresh"
Expand Down Expand Up @@ -327,12 +326,10 @@ func TestTypedClient(t *testing.T) {
indexName := "test-index"
if exists, err := es.Indices.Exists(indexName).IsSuccess(context.Background()); !exists && err == nil {
res, err := es.Indices.Create(indexName).
Request(&create.Request{
Mappings: &types.TypeMapping{
Properties: map[string]types.Property{
"price": types.NewIntegerNumberProperty(),
"name": types.NewKeywordProperty(),
},
Mappings(&types.TypeMapping{
Properties: map[string]types.Property{
"price": types.IntegerNumberProperty{},
"name": types.KeywordProperty{},
},
}).
Do(context.Background())
Expand Down Expand Up @@ -360,6 +357,7 @@ func TestTypedClient(t *testing.T) {
Id int `json:"id"`
Name string `json:"name"`
Price int `json:"price"`
Alt string `json:"alt"`
}

// Indexing synchronously with refresh.Waitfor, one document at a time
Expand All @@ -381,7 +379,7 @@ func TestTypedClient(t *testing.T) {
},
} {
indexed, err := es.Index(indexName).
Request(document).
Document(document).
Id(strconv.Itoa(document.Id)).
Refresh(refresh.Waitfor).
Do(context.Background())
Expand All @@ -391,6 +389,9 @@ func TestTypedClient(t *testing.T) {
if indexed.Result != result.Created {
t.Fatalf("unexpected result during indexation of document: %v, response: %v", document, indexed)
}

document.Alt = fmt.Sprintf("alt_%d", document.Id)
es.Update(indexName, strconv.Itoa(document.Id)).Doc(document).Do(context.Background())
}

// Check for document existence in index
Expand All @@ -412,13 +413,12 @@ func TestTypedClient(t *testing.T) {
// Simple search matching name
res, err := es.Search().
Index(indexName).
Request(&search.Request{
Query: &types.Query{
Match: map[string]types.MatchQuery{
"name": {Query: "Foo"},
},
Query(&types.Query{
Match: map[string]types.MatchQuery{
"name": {Query: "Foo"},
},
}).Do(context.Background())
}).
Do(context.Background())

if err != nil {
t.Fatalf("error runnning search query: %s", err)
Expand All @@ -440,17 +440,15 @@ func TestTypedClient(t *testing.T) {
// Aggregate prices with a SumAggregation
searchResponse, err := es.Search().
Index(indexName).
Request(
&search.Request{
Size: some.Int(0),
Aggregations: map[string]types.Aggregations{
"total_prices": {
Sum: &types.SumAggregation{
Field: some.String("price"),
},
},
Size(0).
Aggregations(map[string]types.Aggregations{
"total_prices": {
Sum: &types.SumAggregation{
Field: some.String("price"),
},
}).Do(context.Background())
},
}).
Do(context.Background())

if err != nil {
t.Fatal(err)
Expand Down
Loading

0 comments on commit d279808

Please sign in to comment.