使用NEST的ElasticSearch Bulk Api请求:如何添加“ _type”:“ doc”

问题描述 投票:0回答:1

我想为(多个循环)创建批量api请求

{ "index" : { "_index" : "idx_name", "_type" : "doc", "_id" : ".."} }
{"field": "value"}

到目前为止,我已经完成了:

{ "index" : { "_index" : "idx_name", "_id" : ".."} }
{"field": "value"}

通过使用:

DefaultMappingFor<classname>(m => m
                .IndexName("idx_name"));

client.Bulk(b => b
        .Index<classname>( i => i
            .Id(Guid.NewGuid())
            .Document(documents) //doc is a field of the class
           ));

我想使用NEST添加_type:“ doc”字段。请帮忙。

c# .net elasticsearch nest
1个回答
0
投票

您不需要,因为mapping types are deprecated将被删除。

您只需要指定索引名称和文档ID,就可以了。

© www.soinside.com 2019 - 2024. All rights reserved.