Repository navigation
Port Obvs.Monitoring.ElasticSearch from NEST to Elastic.Clients.Elasticsearch - #98
Closed
christopherread wants to merge 1 commit into
Closed
christopherread wants to merge 1 commit into
christopherread wants to merge 1 commit into
Conversation
…icsearch NEST is deprecated and can't talk to Elasticsearch 9. Use Elastic.Clients.Elasticsearch 9.5.3: ElasticsearchClient replaces IElasticClient and NodePool replaces IConnectionPool in the public API. Counters are still bulk-indexed into <prefix>-yyyy.MM.dd with camelCase fields, so existing indexes keep working. The tests now run the real client against Elastic's in-memory transport and assert on the bulk requests it sends, as the new client has no interface to fake. Fixes #77 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
Author
|
Combined into #104, which includes this change as its own commit. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #77.
Changes
NEST7.17.5, which is deprecated and can't talk to Elasticsearch 9 servers, is replaced byElastic.Clients.Elasticsearch9.5.3. The new package still supports net472, netstandard2.0 and net10.0.ElasticSearchMonitoruses the new client'sIndexMany(documents, index), and logs errors fromIsValidResponseandElasticsearchServerError.ElasticSearchMonitorFactory(…, IElasticClient client)ElasticSearchMonitorFactory(…, ElasticsearchClient client)ElasticSearchMonitor(…, IElasticClient client)ElasticSearchMonitor(…, ElasticsearchClient client)ConnectToServer(IConnectionPool pool)(Elasticsearch.Net)ConnectToServer(NodePool pool)(Elastic.Transport)ConnectToServer(string uri)is unchanged.The new client supports Elasticsearch 8 and 9 servers, but not 7.
Stored data is unchanged
Counters still go to
<prefix>-yyyy.MM.ddwith camelCase fields (counterName,instanceName,direction,timeStamp, …) and ISO-8601 dates, so existing indexes and dashboards keep working. The index name is now in the request URL (/<index>/_bulk) instead of in each action line, which is equivalent.Tests
The new client has no interface like
IElasticClientto fake. So the tests run the realElasticsearchClientagainst Elastic'sInMemoryRequestInvoker, which answers like a real server, and assert on the_bulkrequests it actually sends.ShouldIndexCountersInDailyIndexWithCamelCaseFields: pins the daily index name and the camelCase fields. It didn't exist before, so it never ran against NEST; the document format was compared against NEST's camelCase defaults by hand.Testing gotcha: the in-memory transport's default response lacks the
x-elastic-productheader. The client then throwsUnsupportedProductException, which the monitor catches and logs, so tests can pass while only exercising the error path. The test setup returns that header.All 125 unit tests pass, and the solution builds for net472, netstandard2.0 and net10.0 with no new warnings. Not run against a real Elasticsearch server: there's no Docker here and no Elasticsearch in CI.
🤖 Generated with Claude Code