# CBOR with Nest and ingest-attachment plugin

**URL:** <https://discuss.elastic.co/t/cbor-with-nest-and-ingest-attachment-plugin/119538>\
**Category:** Elasticsearch\
**Created:** [February 12, 2018, 7:32pm UTC](https://discuss.elastic.co/t/cbor-with-nest-and-ingest-attachment-plugin/119538 "2018-02-12T19:32:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sramalin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sramalin/32/25821_2.png) [@sramalin](https://discuss.elastic.co/u/sramalin)\
**Post date:** [February 12, 2018, 7:32pm UTC](https://discuss.elastic.co/t/cbor-with-nest-and-ingest-attachment-plugin/119538/1 "2018-02-12T19:32:03Z")

</div>

All,  
I have tried the following with the Nest client

```
public class Document
{
    [Text(Ignore = true)]
    public string Id { get; set; }
    public byte[] Content { get; set; }
    public Attachment Attachment { get; set; }
}

public class DumpFileReader
{
    public readonly IEnumerable<string> InputFiles;

    public readonly int FilesCount;

    public IEnumerable<Document> Documents
    {
        get
        {
            return this.InputFiles.SelectMany(this.LazilyReadFiles);
        }
    }

    #endregion

    #region constructor

    public DumpFileReader(string filesDirectory, string fileTypes="*.xml")
{
	this.InputFiles = GetFiles(filesDirectory, fileTypes);
	this.FilesCount = this.InputFiles.Count();
}	

public IEnumerable<Document> Packages => this._files.SelectMany(this.LazilyReadDumps);

public IEnumerable<Document> LazilyReadDumps(string file)
{
    var bytesFile = File.ReadAllBytes(file);
    yield return new Document { Id = Path.GetFileName(file), Content = bytesFile };
}

```

This seems to index correctly when i use the ingest-attachment processor. Is this the right way to use CBOR format? I can not seem to find any examples on the usage.  
Thanks

---

<div class="post-metadata">

**Author:** ![sramalin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sramalin/32/25821_2.png) [@sramalin](https://discuss.elastic.co/u/sramalin)\
**Post date:** [February 16, 2018, 12:22am UTC](https://discuss.elastic.co/t/cbor-with-nest-and-ingest-attachment-plugin/119538/2 "2018-02-16T00:22:24Z")

</div>

Anybody?  
I guess no one uses this approach, something wrong with it?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [February 16, 2018, 6:11am UTC](https://discuss.elastic.co/t/cbor-with-nest-and-ingest-attachment-plugin/119538/3 "2018-02-16T06:11:13Z")

</div>

@Martijn_Laarman do you know? I'm not familiar with Nest.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 16, 2018, 6:11am UTC](https://discuss.elastic.co/t/cbor-with-nest-and-ingest-attachment-plugin/119538/4 "2018-03-16T06:11:16Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
