Error indexing data in Elasticsearch

Hi,
I'm trying to index datas in Elasticsearch, but I'm getting an error.
I'm using the latest Nest release (7.17.0) in C#
The error is "Failed to serialize anonymous type".
This error message is from an exception after use Nest's IndexMany method.
I indexed some data, but at some point this error occurs.

Does anyone have any idea why this happens?
Thanks.

Welcome to our community! :smiley:

I can't directly help with this, but it'd be useful for someone that knows this language if you could show the entire error, and the relevant code section.

Thanks for the answer!

The entire error is below:

Failed to serialize anonymous type: Nest.BulkIndexOperation1[AdsHelpers.AdELSMiscItemBase]. The type defines the following properties: 'Document' of type AdsHelpers.AdELSMiscItemBase 'Percolate' of type System.String 'Pipeline' of type System.String 'IfSequenceNumber' of type System.Nullable1[System.Int64]
'IfPrimaryTerm' of type System.Nullable1[System.Int64] 'Id' of type Nest.Id 'Index' of type Nest.IndexName 'RetriesOnConflict' of type System.Nullable1[System.Int32]
'Routing' of type Nest.Routing
'Version' of type System.Nullable1[System.Int64] 'VersionType' of type System.Nullable1[Elasticsearch.Net.VersionType]

I have a method that fills some objects of AdsHelpers.AdELSMiscItemBase and index in Elasticsearch.
The following is how I initialize the client and use the method that inserts multiple records in Elasticsearch.

ConnectionSettings settings = new ConnectionSettings(new Uri(ElasticsearchUri));
settings.DefaultIndex(indexName);

ElasticClient client = new ElasticClient(settings);

BulkResponse response = client.IndexMany(ads);

The variable "ads" is the list with some AdELSMiscItemBase.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.