# How can i get the Attachment content from my search

**URL:** <https://discuss.elastic.co/t/how-can-i-get-the-attachment-content-from-my-search/361543>\
**Category:** Elasticsearch\
**Created:** [June 16, 2024, 10:28am UTC](https://discuss.elastic.co/t/how-can-i-get-the-attachment-content-from-my-search/361543 "2024-06-16T10:28:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shubham\_007](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shubham_007/32/126964_2.png) [@Shubham\_007](https://discuss.elastic.co/u/Shubham_007)\
**Post date:** [June 16, 2024, 10:28am UTC](https://discuss.elastic.co/t/how-can-i-get-the-attachment-content-from-my-search/361543/1 "2024-06-16T10:28:06Z")

</div>

Hi everyone i was going through Elastic.Client.Elasticsearch 8.13 and came accross an issue of getting the attachments from my search results

This is my Model

```auto
public class ElasticDocument : IEntity
{
    Analyzers CompletionStats { get; set; }
    public string id { get; set; }
    public string Content { get; set; }

    // Not used 
    //public Attachment Attachment { get; set; }
    public AttachmentProcessor AttachmentProcessor { get; set; }
    public DocumentPage[] DocumentPage { get; set; }
    public string IsProcessed { get; set; }
    public SingleSuggestion[] Suggestions { get; set; }
}

```

And this is how i am setting the pipeline

```auto
document.Content = base64File;

var attachmentProcessor = new AttachmentProcessor
{
    Description = "Attachment processor",
    Field = new Field("Content"),
    IndexedChars = -1,
    TargetField = "Attachment"
};

var removeProcessor = new RemoveProcessor
{
    Description = "Remove processor",
    Field = new[] { "Content" } 
};

var pipelinerequest = new PutPipelineRequest(pipeLine)
{
    Description = "document desc",
    Processors = new Processor[] { attachmentProcessor, removeProcessor }
};

var pipelineResponse = await _iElasticConnector._elasticClient.Ingest.PutPipelineAsync(pipelinerequest);

```

How can i get my attachment content out

```auto
var response = await _iElasticConnector._elasticClient.SearchAsync<ElasticDocument>(
 f => f.Index(indexName).Query(p => p.Match(q => q.Field(r => r.id).Query(document.id))).TypedKeys(_useNewerElastic));

var responseDocument = response.Hits.Select(i => new ElasticDocument()
{
    id = i.Source.id,
    Content = i.Source.AttachmentProcessor.Field.... // What are the steps 
}).First;

content = responseDocument.FirstOrDefault()?.Content;

```

Can anyone help me 🙃
