You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/sinks/elasticsearch/common.rs
+27-18Lines changed: 27 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -145,7 +145,10 @@ impl ElasticsearchCommon {
145
145
)
146
146
.await
147
147
{
148
-
Ok(version) => version,
148
+
Ok(version) => {
149
+
debug!(message = "Auto-detected Elasticsearch API version.", %version);
150
+
version
151
+
}
149
152
// This error should be fatal, but for now we only emit it as a warning
150
153
// to make the transition smoother.
151
154
Err(error) => {
@@ -156,11 +159,11 @@ impl ElasticsearchCommon {
156
159
// This is by no means a perfect assumption but it's the best we can
157
160
// make with the data we have.
158
161
let assumed_version = if config.suppress_type_name{6}else{8};
159
-
debug!(message = "Assumed ElasticsearchApi based on config setting suppress_type_name.",
162
+
debug!(message = "Assumed Elasticsearch API version based on config setting suppress_type_name.",
160
163
%assumed_version,
161
164
%config.suppress_type_name
162
165
);
163
-
warn!(message = "Failed to determine Elasticsearch version from `/_cluster/state/version`. Please fix the reported error or set an API version explicitly via `api_version`.",
166
+
warn!(message = "Failed to determine Elasticsearch API version. Please fix the reported error or set an API version explicitly via `api_version`.",
164
167
%assumed_version,
165
168
%error
166
169
);
@@ -277,28 +280,34 @@ async fn get_version(
277
280
proxy_config:&ProxyConfig,
278
281
) -> crate::Result<usize>{
279
282
#[derive(Deserialize)]
280
-
structClusterState{
281
-
version:Option<usize>,
283
+
structVersion{
284
+
number:Option<String>,
285
+
}
286
+
#[derive(Deserialize)]
287
+
structResponsePayload{
288
+
version:Option<Version>,
282
289
}
283
290
284
291
let client = HttpClient::new(tls_settings.clone(), proxy_config)?;
285
-
let response = get(
286
-
base_url,
287
-
http_auth,
288
-
aws_auth,
289
-
region,
290
-
request,
291
-
client,
292
-
"/_cluster/state/version",
293
-
)
294
-
.await
295
-
.map_err(|error| format!("Failed to get Elasticsearch API version: {}", error))?;
292
+
let response = get(base_url, http_auth, aws_auth, region, request, client,"/")
293
+
.await
294
+
.map_err(|error| format!("Failed to get Elasticsearch API version: {}", error))?;
296
295
297
296
let(_, body) = response.into_parts();
298
297
letmut body = body::aggregate(body).await?;
299
298
let body = body.copy_to_bytes(body.remaining());
300
-
letClusterState{ version } = serde_json::from_slice(&body)?;
0 commit comments