- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我在使用 NEST 中的批量方法将索引子记录到 Elasticsearch 中时遇到问题。
我正在使用 ElasticSearch 2.3.5 和 NEST 2.4.4
我已经映射了一个索引:
myindex
{
"mappings": {
"elasticparent": {},
"elasticchild": {
"_parent": {
"type": elasticparent
}
}
}
}
我已经使用 IndexMany 方法为父对象编制了索引:
client.IndexMany<elasticparent>(batch, "myindex");
这一切都很好。
我现在想使用 IndexMany 为 child 编制索引。到目前为止,这是我尝试过的:
client.Bulk(s => s.IndexMany(IenumerableOfChild,
(bulkDescriptor, record) =>
bulkDescriptor.Index("myindex").Type("elasticchild").Parent(record.Id)));
child 和 parent 共享相同的 Id 整数。
我没有收到错误,但子项永远不会被索引,文档也永远不会添加到总索引数中。
将它们单独编入索引:
foreach (var child in IenumerableOfChild
{
client.Index(child, descriptor => descriptor
.Parent(child.Id.ToString()).Index("myindex"));
}
我不想单独索引质量数。我想使用 IndexMany 来批量索引子记录。有人可以指出我做错了什么吗?
最佳答案
经过进一步调查,弹性服务器返回超时。通过一次将请求批处理到 1000 个项目,它现在可以正常工作了!
foreach (IEnumerable<object> batch in objects.Batch(1000))
{
var indexResponse = client.Bulk(s => s.IndexMany(batch,
(bulkDescriptor, record) =>
bulkDescriptor.Index("myindex").Parent(record.Id.ToString()).Document(record).Type("elasticchild").Id(record.Id.ToString())));
Console.WriteLine(indexResponse);
}
关于c# - Elasticsearch C# NEST IndexMany child ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39234432/
我在使用 NEST 的方法 IndexMany(批量索引)时遇到了一个小问题。我发现当我将一些项目发送到 elasticsearch 进行索引时,立即返回响应,但此时并非所有文档都被索引。 问题可以很
我一直致力于将我的 ElasticSearch (ES) 0.9 代码转换为与 ES 1.0 一起使用。这需要将 NEST 升级到最新的预发布版本。 我一直在尝试批量索引一组子文档。我已将他们的映射设
我正在努力解决一个问题。我正在构建一个应用程序,我们在其中索引 Elastic 中的 Assets 。 Assets 的本质是非常动态的,因为它们包含客户端元数据,这因客户端而异。 因此,索引是从 C
我在使用 NEST 中的批量方法将索引子记录到 Elasticsearch 中时遇到问题。 我正在使用 ElasticSearch 2.3.5 和 NEST 2.4.4 我已经映射了一个索引:
我尝试使用 nest for ElasticSearch 来理解索引选项,我执行了每个选项,这是我的结果: var node = new Uri("http://localhost:9200"
我在使用批量 API (C# NEST v5.4) 插入文档时遇到问题。我有一个文件数组,在这个数组里面有我的 ID。 我的代码是: documents = documents .ToArray();
我是一名优秀的程序员,十分优秀!