Skip to content

NEST 2.4.6 BulkDescriptor.Update hangs on dynamic objects #2981

@SLavrynenko

Description

@SLavrynenko

NEST/Elasticsearch.Net version: 2.4.6

Elasticsearch version: 2.4.1

I need to do partial updates in a bulk, so have the following code:

var descriptor = new BulkDescriptor();

var str = "{  \"Location\": null,  \"Id\": \"1_1\",  \"ContactId\": 1,  \"ClientId\": 1}";                        
var partialObject = JsonConvert.DeserializeObject<dynamic>(str);

// This works fine
var response = client.Update<MyType, object>(DocumentPath<MyType>.Id("1_1").Index("Index1"),u => u.Doc(partialObject));

// This works fine also
descriptor.Update<MyType, dynamic>(
  op => op
    .Index("Index1")
    .Id("1_1")
    .Doc(new { Id = "1_1", ContactId = 1, ClientId = 1 })
    .DocAsUpsert());

// Here it takes forever to process (looks like it gets into infinitive loop) without any exception
descriptor.Update<MyType, dynamic>(op => op.Index("Index1").Id("1_1").Doc(partialObject).DocAsUpsert());

Some notes:
It looks that it happens because I've "Location": nul field on my dynamic. But why then it works fine with the Update method (not in a BulkDescriptor)

I need partial update to update all the fields on my object even if they are null. I can't use an exact type because I have a big type that is stored at Elastic index so I'm building dynamic object with those fields that I really need to update.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions