无法使用嵌套和弹性搜索批量创建文档 读取字符串时出错。 "Unexpected token: StartObject. Path 'items[0].create.error'"



我正在尝试批量创建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来检查是否存在要创建的文档。

相关内容

最新更新