小编Mei*_*Mei的帖子

如果在插入请求后立即发送删除请求,则不会删除文档

我有一项索引文档的服务。该服务收到以下两个请求 - 第一个是插入文档,第二个是删除文档。当它们之间有一段时间时,它工作正常,但当它们相继发送时,文档不会被删除。我从 Nest 得到的回应看起来很成功。

我的函数有点长,所以我只会在里面写插入和删除。如果需要更多信息,我将添加它(例如,如果插入,也会从所有其他可用索引中删除它,并根据需要插入一些映射)。

插入代码:

IBulkResponse res = await _client.IndexManyAsync(entities, index, type);
Run Code Online (Sandbox Code Playgroud)

删除代码:

var termFilter = new List<Func<QueryContainerDescriptor<JObject>, QueryContainer>>
        {
            c => c.Terms(t => t.Field(ID_FIELD).Terms(ids))
        };

        await _client.DeleteByQueryAsync<JObject>(indices, types, d => d.Query(q => q.Bool(b => b.Must(termFilter))));
Run Code Online (Sandbox Code Playgroud)

例如,这个集成测试不起作用:

var indices = new { "some_index_1", "some_index_2" };
var entity = new Entity {  Action = ReplicationAction.INSERT, ... };
await elasticDal.Insert(new List { entity }, "some_index_1", "666", indices);
entity.Action = ReplicationAction.DELETE;
await elasticDal.Insert(new List { entity }, "some_index_1", "666", indices);
Run Code Online (Sandbox Code Playgroud)

版本:ElasticSearch …

elasticsearch nest

5
推荐指数
1
解决办法
1403
查看次数

标签 统计

elasticsearch ×1

nest ×1