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
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
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
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