Skip to content

5.0 RC4 - Nest.Attachment.Title is always null. #2466

@tsgkdt

Description

@tsgkdt

NEST/Elasticsearch.Net version: 5.0.0-RC4

Elasticsearch version: 5.0.1

Description of the problem including expected versus actual behavior:

expected : If result json includes title, it should assign value to attachement.title.
actual : Attachment.Title value is always null.

Steps to reproduce:

  1. Create Index.
POST documents/document/1
{
    "id" : 1,
    "path": "/a/b/c/d/",
    "attachment":{
      "author": "author",
      "content": "I have a pen. I have an apple",
      "content_length": 12345,
      "content_type": "plain/txt",
      "date" : "2016-12-06T12:34:56Z",
      "language": "ja",
      "name": "name",
      "title": "title test",
      "keywords": "keywords",
      "indexed_chars": 12345,
      "detect_language" : "ja"
    }
}
  1. Get Index.
public class Document
{
  public int Id { get; set; }
  public string Path { get; set; }
  public string Content { get; set; }
  public Attachment Attachment { get; set; }
}

and get document (using nest)

var connectionSettings = new ConnectionSettings(
                             new Uri("http://xxx.xxx.xxx.xxx:9200"))
                             .DisableDirectStreaming();
var client = new ElasticClient(connectionSettings);
var response = client .Get<Document>(1, idx => idx.Index("documents"));
Console.WriteLine(response.DebugInformation);
var document = response.Source;
  1. Access Attachment.Title

Title value is null. (should be "title test").

Provide ConnectionSettings (if relevant):

N/A

Provide DebugInformation (if relevant):

# Response:
{"_index":"documents","_type":"document","_id":"1","_version":1,"found":true,"_source":{
    "id" : 1,
    "path": "/a/b/c/d/",
    "attachment":{
      "author": "author",
      "content": "I have a pen. I have an apple",
      "content_length": 12345,
      "content_type": "plain/txt",
      "date" : "2016-12-06T12:34:56Z",
      "language": "ja",
      "name": "name",
      "title": "title test",
      "keywords": "keywords",
      "indexed_chars": 12345,
      "detect_language" : "ja"
    }
}

Response json has "title" . but, Attachment.Title field value is null.

In Nest/Mapping/Types/Specialized/Attachment.cs (ReadJson method),
it seems to title is not used any which case.

ref
Elastic Discuss Japanese

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