CBOR with Nest and ingest-attachment plugin

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

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

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

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