Skip to content

MapIdPropertyFor field not being used when null Id passed in #2838

Closed
@spresnal

Description

@spresnal

NEST/Elasticsearch.Net version: 5.x

Elasticsearch version: 5.2

Description of the problem including expected versus actual behavior:
When I pass a null Id into the 1.x NEST client, the client overwrites the value with the MapIdPropertyFor property instead of passing null to ElasticSearch.

When I pass a null Id into the 5.x NEST client, the client does not overwrite the value with the MapIdPropertyFor property and passes null to ElasticSearch.

Steps to reproduce:

  1. Add MapIdPropertyFor to ConnectionSettings
  2. Index a document with the Id field populated with a null value
  3. See POST to ElasticSearch containing null instead of MapIdPropertyFor Value

Provide ConnectionSettings (if relevant):
nestConnectionSettings.MapIdPropertyFor(x => x.Name);

Provide DebugInformation (if relevant):
bd.Index(b => b
.Index(doc.Index)
.Type(doc.DocType)
.Id(null)
.Document(doc.Document));
Result Id: null

bd.Index(b => b
.Index(doc.Index)
.Type(doc.DocType)
.Document(doc.Document));
Result Id: doc.Name

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