Closed jimiee closed 1 year ago
Please upgrade to latest version (v11.7.4.240)
I've upgraded to the latest version now but i'm still getting the same error message.
You have created a new ScheduledPlugIn for indexing CustomDocument?
You can try to call something like this with your ScheduledPlugin
public void Index(List<CustomDocument> documents, out string errorMessage, out int indexed, out int bulkErrors)
{
errorMessage = string.Empty;
indexed = 0;
bulkErrors = 0;
string indexName = GetYourCustomDocumentIndexWithLanguage();
BulkOperation[] bulkOperations = documents.Select(d => new BulkOperation(indexName, d, <id???>)).ToArray();
_indexer.Service.UpdateMapping(typeof(CustomDocument), typeof(CustomDocument), indexName, <language>, false);
BulkBatchResult bulkResult = _indexer.Service.Bulk(bulkOperations);
foreach (BulkResult item in bulkResult.Batches)
{
if (!item.Errors)
{
indexed += item.Items.Length;
}
else
{
IEnumerable<string> errors = item.Items.Where(i => !string.IsNullOrWhiteSpace(i.Error?.Reason)).Select(i => i.Error.Reason);
errorMessage = string.Concat(errorMessage, " ", string.Join(" ", errors));
bulkErrors++;
}
}
}
No feedback
I'm trying to index a custom type but are getting an error that is found in BulkBatchResult (using v11.7.3): Status: 400 Error: Invalid type: expecting [Epinova_ElasticSearch_Core_models-IndexItem] but got [CustomDocument]
I'm using the code from under the section named "Custom types (non-Episerver content)" in the documentation: https://github.com/Epinova/Epinova.Elasticsearch#user-content-custom-types-non-episerver-content