Releases: elastic/go-elasticsearch
8.4.0-alpha.1
This prerelease introduces a new typed API generated from the elasticsearch-specification. This generation from the common specification allows us to provide a complete API which uses an exhaustive hierarchy of types reflecting the possibilities given by Elasticsearch.
This new API is the next iteration of the Go client for Elasticsearch, it now lives alongside the existing API, it is in alpha
state and will gain features over time and releases.
What's new
The TypedClient
is built around a fluent builder for easier request creation and a collection of structures and helpers that mimics as closely as possible the Elasticsearch JSON API.
As a first example, here is a search request:
cfg := elasticsearch.Config{
// Define your configuration
}
es, _ := elasticsearch.NewTypedClient(cfg)
res, err := es.Search().
Index("index_name").
Request(&search.Request{
Query: &types.QueryContainer{
Match: map[types.Field]types.MatchQuery{
"name": {Query: "Foo"},
},
},
},
).Do(context.Background())
The Request
uses the structures found in the typedapi/types
package which will lead you along the possibilities. A builder for each structure that allows easier access and declaration is also provided.
More on the specifics and a few examples of standard use-cases can be found in the TypedAPI section of the documentation.
Limitations
While most of the endpoints are covered, a few points are still being worked on and will be part of future releases:
- NDJSON endpoints:
bulk
,msearch
,msearch_template
,ML.post_data
,find_structure
, to name a few. - Response and Errors structures with deserialization.
Transport & config
While being different, the new API uses all the existing layers that were built so far, elastic-transport-go
remains the preferred transport and all your configuration and credentials applies, same as before.
Feedback
Feedback is very welcome, play with it, use it, let us know what you think!
8.3.0
API
ML.InferTrainedModelDeployment
renamed toInferTrainedModel
ML.PreviewDatafeed
has two new parameters,start
andend
. DocumentationML.StartTrainedModelDeployment
has three new parameters,number_of_allocations
,threads_per_allocation
andqueue_capacity
. DocumentationCluster.DeleteVotingConfigExclusions
has a newmaster_timeout
parameter.Cluster.PostVotingConfigExclusions
has a newmaster_timeout
parameter.Snapshot.Get
has a newindex_names
parameters (boolean). Whether to include the name of each index in the snapshot. Defaults to true.
New APIs
Security.HasPrivilegesUserProfile
(Experimental API) Documentation
8.2.0
Client
- Fixed a serialisation error for
retry_on_conflict
in the BulkIndexer. Thanks to @lpflpf for the help! - Fixed a concurrent map error in the BulkIndexer when custom headers are applied. Thanks to @chzhuo for the contribution!
API
New APIs
-
Cat.ComponentTemplates
-
ML.GetMemoryStats
documentation -
Security.activateUserProfile
(Experimental API) Documentation -
Security.disableUserProfile
(Experimental API) Documentation -
Security.enableUserProfile
(Experimental API) Documentation -
Security.getUserProfile
(Experimental API) Documentation -
Security.suggestUserProfiles
(Experimental API) Documentation -
Security.updateUserProfileData
(Experimental API) Documentation
8.1.0
API
- API is generated from the Elasticsearch 8.1.0 specification.
New parameters
WithWaitForCompletion
forIndices.Forcemerge
WithFeatures
forIndices.Get
WithForce
forML.DeleteTrainedModel
New APIs
OidcAuthenticate
,OidcLogout
andOidcPrepareAuthentication
see documentationTransformResetTransform
7.17.1
Client
- Fixed serialization of the
routing
parameter for theBulkIndexerItem
routing property.
8.0.0
Client
- The client now uses
elastic-transport-go
dependency which lives in its own repository. - With the knewly extracted transport, the
retryOnTimeout
has been replaced with aretryOnError
callback. This allows to select more finely which error should be retried by the client. BulkIndexerItem
Body
field is now anio.ReadSeeker
allowing reread without increasing memory consumption.BulkIndexerItem
know correctly uses therouting
property instead of the deprecated_routing
.
API
- API is generated from the Elasticsearch 8.0.0 specification.
7.17.0
Client
- Fixed a race condition on metrics in transport #397, thanks @mainliufeng !
- The client will now return an error if a required arguments is passed as a nil value. #201
- API is compatible with Elasticsearch 7.17.0
8.0.0-alpha
Client
Elastic Transport
- This is the first release using the all new
elastictransport
which now lives in the elastic-transport-go repository. The goal is to allow for reuse between this and future Go clients.
API
- Changed the
Body
parameter forBulkIndexerItem
in favor ofio.ReadSeeker
to lower memory consumption when using theesutil.BulkIndexer
. - Replaced the
Config
optionRetryOnTimeout
in favor of a newRetryOnError
function which allows to dynamically chose what error should be retried.
7.16.0
Client
-
Adds versioning and routing options to the
BulkIndexer
. Thanks to @mehran-prs and @munkyboy ! -
Adds CA fingerprinting. You can configure the client to only trust certificates that are signed by a specific CA certificate (CA certificate pinning) by providing a ca_fingerprint option. This will verify that the fingerprint of the CA certificate that has signed the certificate of the server matches the supplied value:
elasticsearch.NewClient(Config{
Addresses: []string{"https://elastic:changeme@localhost:9200"},
CertificateFingerprint: "A6FB224A4386..."
})
API
-
New APIs:
- ModifyDataStream, documentation
- TransformUpgradeTransforms, documentation
- Migration.GetFeatureUpgradeStatus, documentation
- Migration.PostFeatureUpgrade, documentation
-
New Experimental API:
- FleetSearch, documentation
- FleetMsearch, documentation
-
Changes:
- DeleteByQuery
- Removed _source, _source_excludes, _source_includes parameters.
- UpdateByQuery
- Removed _source, _source_excludes, _source_includes parameters.
- OpenPointInTime
- The parameter keep_alive is now required.
- SearchMvt
- Added TrackTotalHits, Indicate if the number of documents that match the query should be tracked. A number can also be specified, to accurately track the total hit count up to the number.
- IngestPutPipeline
- Added WithIfVersion, required version for optimistic concurrency control for pipeline updates.
- IndicesGetIndexTemplate
- WithName, a pattern that returned template names must match.
- NodesHotThreads
- WithSort, the sort order for 'cpu' type (default: total).
- MLPutTrainedModel
- WithDeferDefinitionDecompression, if set to
true
and acompressed_definition
is provided, the request defers definition decompression and skips relevant validations.
- WithDeferDefinitionDecompression, if set to
- TransformDeleteTransform
- WithTimeout, controls the time to wait for the transform deletion.
- TransformPutTransform
- WithTimeout, controls the time to wait for the transform to start.
- TransformUpdateTransform
- WithTimeout, controls the time to wait for the update.
- DeleteByQuery
-
Promoted to stable:
- FleetGlobalCheckpoints
- GetScriptContext
- GetScriptLanguages
- IndicesResolveIndex
- MonitoringBulk
- RankEval
- SearchableSnapshotsMount
- SearchableSnapshotsStats
- SecurityClearCachedServiceTokens
- SecurityCreateServiceToken
- SecurityDeleteServiceToken
- SecurityGetServiceAccounts
- SecurityGetServiceCredentials
- ShutdownDeleteNode
- ShutdownGetNode
- ShutdownPutNode
- TermsEnum
7.15.1
Client
- Allow User-Agent override via the
userAgentHeader
header. Credit goes to @aleksmaus!