Skip to content

fix(deps): update module github.com/elastic/go-elasticsearch/v8 to v9 #39559

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Apr 22, 2025

This PR contains the following updates:

Package Change Age Confidence
github.com/elastic/go-elasticsearch/v8 v8.18.1 -> v9.0.0 age confidence

Warning

Some dependencies could not be looked up. Check the Dependency Dashboard for more information.

⚠️ MAJOR VERSION UPDATE ⚠️ - please manually update this package


Release Notes

elastic/go-elasticsearch (github.com/elastic/go-elasticsearch/v8)

v9.0.0: 9.0.0

Compare Source

  • The client now requires Go 1.23 or later.

New

  • This release introduces an optional package for the TypedAPI named esdsl.
    It provides a domain-specific language (DSL) for building Elasticsearch queries in Go.
    The DSL is designed to simplify query construction, making it easier to build complex queries without writing raw JSON.
// create index
{
    // delete index if exists
    if existsRes, err := es.Indices.Exists("test").IsSuccess(context.Background()); err != nil {
        log.Println(err)
        return
    } else if existsRes {
        if ok, _ := es.Indices.Delete("test").IsSuccess(context.Background()); !ok {
            log.Fatalf("Error deleting index: %v\n", err)
        }
        log.Println("Index deleted:", "test")
    } else {
        log.Println("Index does not exist:", "test")
    }

    mappings := esdsl.NewTypeMapping().
        AddProperty("name", esdsl.NewTextProperty()).
        AddProperty("age", esdsl.NewIntegerNumberProperty())

    createRes, err := es.Indices.Create("test").Mappings(mappings).Do(context.Background())
    if err != nil {
        log.Println(err)
        return
    }

    log.Printf("Index created: %#v\n", createRes)
}

// index document
{
    documents := []Document{
        {"Alice", 30},
        {"Bob", 25},
        {"Charlie", 35},
    }

    bulk := es.Bulk().Index("test")
    for _, document := range documents {
        err := bulk.IndexOp(types.IndexOperation{}, document)
        if err != nil {
            log.Println("Error indexing document:", err)
        }
    }
    bulkRes, err := bulk.Refresh(refresh.Waitfor).Do(context.Background())
    if err != nil {
        log.Println(err)
        return
    }
    if bulkRes.Errors {
        log.Println("Some documents failed to index")
        for _, item := range bulkRes.Items {
            for operationType, responseItem := range item {
                if responseItem.Error != nil {
                    log.Println("Operation:", operationType)
                    log.Println("Response:", responseItem)
                }
            }
        }
    }
    indexedDocs := 0
    for _, item := range bulkRes.Items {
        for _, responseItem := range item {
            if responseItem.Error == nil {
                indexedDocs++
            }
        }
    }

    log.Println("Documents indexed:", indexedDocs)
}

// calculate median age
{
    searchRes, err := es.Search().
        Index("test").
        Size(0).
        AddAggregation("median_age", esdsl.NewPercentilesAggregation().Field("age").Percents(50)).
        Do(context.Background())
    if err != nil {
        log.Println(err)
        return
    }

    if agg, ok := searchRes.Aggregations["median_age"].(*types.TDigestPercentilesAggregate); ok {
        if val, ok := agg.Values.(map[string]interface{})["50.0"]; ok {
            log.Println("Median age:", val)
        }
    }
}

// search documents
{
    matchRes, err := es.Search().
        Index("test").
        Query(esdsl.NewBoolQuery().
            Must(esdsl.NewMatchQuery("name", "Alice")).
            Filter(esdsl.NewNumberRangeQuery("age").Gte(20).Lte(40))).
        Sort(esdsl.NewSortOptions().AddSortOption("age", esdsl.NewFieldSort(sortorder.Asc))).
        Size(10).
        Do(context.Background())
    if err != nil {
        log.Println(err)
        return
    }
    if matchRes.Hits.Total.Value > 0 {
        for _, hit := range matchRes.Hits.Hits {
            doc := Document{}
            err := json.Unmarshal(hit.Source_, &doc)
            if err != nil {
                log.Println("Error unmarshalling document:", err)
                continue
            }
            log.Printf("Document ID: %s, Name: %s, Age: %d\n", *hit.Id_, doc.Name, doc.Age)
        }
    } else {
        log.Println("No documents found")
    }
}

API

  • Updated APIs to 9.0.0

Typed API


Configuration

📅 Schedule: Branch creation - "on tuesday" (UTC), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate renovate bot requested a review from a team as a code owner April 22, 2025 18:04
@renovate renovate bot added the dependency-major-update Indicates a dependency major version bump label Apr 22, 2025
@renovate renovate bot requested a review from edmocosta April 22, 2025 18:04
@crobert-1
Copy link
Member

This will need to be fixed manually

@renovate renovate bot force-pushed the renovate/g.yxqyang.asia-elastic-go-elasticsearch-v8-9.x branch from 4df4280 to 181ae1f Compare April 24, 2025 06:10
@renovate renovate bot changed the title fix(deps): update module github.com/elastic/go-elasticsearch/v8 to v9 Update module github.com/elastic/go-elasticsearch/v8 to v9 Apr 24, 2025
@renovate renovate bot changed the title Update module github.com/elastic/go-elasticsearch/v8 to v9 fix(deps): update module github.com/elastic/go-elasticsearch/v8 to v9 Apr 24, 2025
@renovate renovate bot changed the title fix(deps): update module github.com/elastic/go-elasticsearch/v8 to v9 Update module github.com/elastic/go-elasticsearch/v8 to v9 Apr 24, 2025
@renovate renovate bot changed the title Update module github.com/elastic/go-elasticsearch/v8 to v9 fix(deps): update module github.com/elastic/go-elasticsearch/v8 to v9 May 6, 2025
@renovate renovate bot changed the title fix(deps): update module github.com/elastic/go-elasticsearch/v8 to v9 Update module github.com/elastic/go-elasticsearch/v8 to v9 May 6, 2025
@renovate renovate bot changed the title Update module github.com/elastic/go-elasticsearch/v8 to v9 fix(deps): update module github.com/elastic/go-elasticsearch/v8 to v9 May 7, 2025
@renovate renovate bot force-pushed the renovate/g.yxqyang.asia-elastic-go-elasticsearch-v8-9.x branch from 181ae1f to e3ab191 Compare May 7, 2025 12:01
@renovate renovate bot changed the title fix(deps): update module github.com/elastic/go-elasticsearch/v8 to v9 Update module github.com/elastic/go-elasticsearch/v8 to v9 May 9, 2025
@renovate renovate bot changed the title Update module github.com/elastic/go-elasticsearch/v8 to v9 fix(deps): update module github.com/elastic/go-elasticsearch/v8 to v9 May 13, 2025
@renovate renovate bot changed the title fix(deps): update module github.com/elastic/go-elasticsearch/v8 to v9 fix(deps): update module github.com/elastic/go-elasticsearch/v8 to v9 - autoclosed May 13, 2025
@renovate renovate bot closed this May 13, 2025
@renovate renovate bot deleted the renovate/g.yxqyang.asia-elastic-go-elasticsearch-v8-9.x branch May 13, 2025 10:57
@renovate renovate bot changed the title fix(deps): update module github.com/elastic/go-elasticsearch/v8 to v9 - autoclosed fix(deps): update module github.com/elastic/go-elasticsearch/v8 to v9 May 13, 2025
@renovate renovate bot reopened this May 13, 2025
@renovate renovate bot force-pushed the renovate/g.yxqyang.asia-elastic-go-elasticsearch-v8-9.x branch 2 times, most recently from e3ab191 to cb44c45 Compare May 13, 2025 13:21
@renovate renovate bot changed the title fix(deps): update module github.com/elastic/go-elasticsearch/v8 to v9 Update module github.com/elastic/go-elasticsearch/v8 to v9 May 15, 2025
@renovate renovate bot changed the title Update module github.com/elastic/go-elasticsearch/v8 to v9 fix(deps): update module github.com/elastic/go-elasticsearch/v8 to v9 May 20, 2025
@renovate renovate bot changed the title fix(deps): update module github.com/elastic/go-elasticsearch/v8 to v9 fix(deps): update module github.com/elastic/go-elasticsearch/v8 to v9 - autoclosed May 21, 2025
@renovate renovate bot closed this May 21, 2025
@renovate renovate bot changed the title fix(deps): update module github.com/elastic/go-elasticsearch/v8 to v9 - autoclosed fix(deps): update module github.com/elastic/go-elasticsearch/v8 to v9 May 27, 2025
@renovate renovate bot reopened this May 27, 2025
@renovate renovate bot force-pushed the renovate/g.yxqyang.asia-elastic-go-elasticsearch-v8-9.x branch 2 times, most recently from cb44c45 to 1d4643a Compare May 27, 2025 15:47
@renovate renovate bot changed the title fix(deps): update module github.com/elastic/go-elasticsearch/v8 to v9 Update module github.com/elastic/go-elasticsearch/v8 to v9 Jun 6, 2025
@renovate renovate bot changed the title Update module github.com/elastic/go-elasticsearch/v8 to v9 Update module github.com/elastic/go-elasticsearch/v8 to v9 - autoclosed Jun 11, 2025
@renovate renovate bot closed this Jun 11, 2025
@renovate renovate bot changed the title Update module github.com/elastic/go-elasticsearch/v8 to v9 - autoclosed Update module github.com/elastic/go-elasticsearch/v8 to v9 Jun 17, 2025
@renovate renovate bot reopened this Jun 17, 2025
@renovate renovate bot force-pushed the renovate/g.yxqyang.asia-elastic-go-elasticsearch-v8-9.x branch from 924d176 to 1d4643a Compare June 17, 2025 15:11
@renovate renovate bot changed the title Update module github.com/elastic/go-elasticsearch/v8 to v9 fix(deps): update module github.com/elastic/go-elasticsearch/v8 to v9 Jun 17, 2025
@renovate renovate bot force-pushed the renovate/g.yxqyang.asia-elastic-go-elasticsearch-v8-9.x branch from 1d4643a to c2e7e77 Compare June 17, 2025 16:02
@renovate renovate bot force-pushed the renovate/g.yxqyang.asia-elastic-go-elasticsearch-v8-9.x branch from c2e7e77 to ac894b8 Compare June 18, 2025 15:39
@renovate renovate bot changed the title fix(deps): update module github.com/elastic/go-elasticsearch/v8 to v9 Update module github.com/elastic/go-elasticsearch/v8 to v9 Jun 23, 2025
@renovate renovate bot changed the title Update module github.com/elastic/go-elasticsearch/v8 to v9 fix(deps): update module github.com/elastic/go-elasticsearch/v8 to v9 Jun 26, 2025
@renovate renovate bot changed the title fix(deps): update module github.com/elastic/go-elasticsearch/v8 to v9 Update module github.com/elastic/go-elasticsearch/v8 to v9 Jun 30, 2025
@renovate renovate bot changed the title Update module github.com/elastic/go-elasticsearch/v8 to v9 fix(deps): update module github.com/elastic/go-elasticsearch/v8 to v9 Jul 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant