Skip to content

Conversation

trap-renovate[bot]
Copy link
Contributor

@trap-renovate trap-renovate bot commented May 23, 2025

This PR contains the following updates:

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

Release Notes

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

v9.1.0: 9.1.0

Compare Source

API

  • Updated APIs to 9.1.0

Typed API

  • Update TypedAPI to latest elasticsearch-specification 9.1
  • This release introduces a new MethodAPI used by the TypedClient which makes the client friendlier for dead code elimination.
    Reducing the size of the client when only a subset of the APIs are used. The old API structure remains available for backward compatibility, but it is now deprecated.

v9.0.1: 9.0.1

Compare Source

API

  • Updated APIs to 9.0.4

Typed API

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 - At any time (no schedule defined), 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 has been generated by Renovate Bot.

@trap-renovate trap-renovate bot added renovate/gomod (Renovate) Pull requests related to go.mod update type/major (Renovate) Pull requests that update major version labels May 23, 2025
@trap-renovate trap-renovate bot force-pushed the renovate/github.com-elastic-go-elasticsearch-v8-9.x branch 15 times, most recently from ccb452c to bf2aae5 Compare May 30, 2025 20:25
@trap-renovate trap-renovate bot force-pushed the renovate/github.com-elastic-go-elasticsearch-v8-9.x branch 11 times, most recently from bfee26d to f443844 Compare June 6, 2025 20:26
@trap-renovate trap-renovate bot force-pushed the renovate/github.com-elastic-go-elasticsearch-v8-9.x branch from f443844 to bb94908 Compare June 9, 2025 01:51
@trap-renovate trap-renovate bot force-pushed the renovate/github.com-elastic-go-elasticsearch-v8-9.x branch 15 times, most recently from 771c1ce to 86e211e Compare October 14, 2025 20:35
@trap-renovate trap-renovate bot force-pushed the renovate/github.com-elastic-go-elasticsearch-v8-9.x branch 13 times, most recently from 770a0ef to b23b23b Compare October 20, 2025 20:26
@trap-renovate trap-renovate bot force-pushed the renovate/github.com-elastic-go-elasticsearch-v8-9.x branch from b23b23b to 1fdf932 Compare October 20, 2025 20:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

renovate/gomod (Renovate) Pull requests related to go.mod update type/major (Renovate) Pull requests that update major version

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants