Skip to content
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

Add more logging for ElasticSearch #16563

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,11 @@ public async Task<string> GetIndexMappings(string indexName)
{
var response = await _elasticClient.LowLevel.Indices.GetMappingAsync<StringResponse>(GetFullIndexName(indexName));

if (!response.Success)
{
_logger.LogWarning("There were issues retrieving index mappings from Elasticsearch. {OriginalException}", response.OriginalException);
}

return response.Body;
}

Expand Down Expand Up @@ -305,6 +310,7 @@ public async Task SetLastTaskId(string indexName, long lastTaskId)
/// </summary>
public async Task<long> GetLastTaskId(string indexName)
{
var mappings = await GetIndexMappings(indexName);
var jsonDocument = JsonDocument.Parse(await GetIndexMappings(indexName));
jsonDocument.RootElement.TryGetProperty(GetFullIndexName(indexName), out var jsonElement);
jsonElement.TryGetProperty("mappings", out var mappings);
Expand Down Expand Up @@ -333,7 +339,7 @@ public async Task<bool> DeleteDocumentsAsync(string indexName, IEnumerable<strin

if (response.Errors)
{
_logger.LogWarning("There were issues deleting documents from Elasticsearch. {result.OriginalException}", response.OriginalException);
_logger.LogWarning("There were issues deleting documents from Elasticsearch. {OriginalException}", response.OriginalException);
}

success = response.IsValid;
Expand Down Expand Up @@ -427,7 +433,7 @@ public async Task StoreDocumentsAsync(string indexName, IEnumerable<DocumentInde

if (result.Errors)
{
_logger.LogWarning("There were issues reported indexing the documents. {result.ServerError}", result.ServerError);
_logger.LogWarning("There were issues reported indexing the documents. {ServerError}", result.ServerError);
}
}
}
Expand Down