我正在尝试批量创建ElasticSearch中已经存在的文档。
descriptor.Create<D>(op => op.Document((D)baseNotice));
_elasticClient.Bulk(descriptor);
我在那里得到了序列化程序异常
Exception thrown: 'Newtonsoft.Json.JsonReaderException' in Elasticsearch.Net.dll
Additional information: Error reading string. Unexpected token: StartObject. Path 'items[0].create.error', line 1, position 123.
索引方法有效,但我需要使用创建操作
descriptor.Index<D>(op => op.Document((D)baseNotice));
您可以浏览批量列表,删除已经存在的批量,然后调用create。您可以使用multiGet来检查是否存在要创建的文档。