# \[Question\] Client .Net Nest with attachment highlight feature

**URL:** <https://discuss.elastic.co/t/question-client-net-nest-with-attachment-highlight-feature/19967>\
**Category:** Elasticsearch\
**Created:** [September 25, 2014, 4:23pm UTC](https://discuss.elastic.co/t/question-client-net-nest-with-attachment-highlight-feature/19967 "2014-09-25T16:23:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jac](https://avatars.discourse-cdn.com/v4/letter/j/df788c/32.png) [@Jac](https://discuss.elastic.co/u/Jac)\
**Post date:** [September 25, 2014, 4:23pm UTC](https://discuss.elastic.co/t/question-client-net-nest-with-attachment-highlight-feature/19967/1 "2014-09-25T16:23:43Z")

</div>

Hello everyone,

I started recently using ES, with its .net client NEST.  
A lot of questions to ask.

I'm currently blocked while trying to highlight search results in  
attachment field.  
The indexation works well, the mapping seems correct, the encode and decode  
work well too,

Once I tried to search by keyword, EA seems to be able to find the right  
documents which contain the keyword, but in the highlight result, instead  
of showing the decoded text, it shows nothing, or the encoded one.

Read from another post treating some same features, the solution is to set  
store = yes.

So I tried to configure it in my C# class file with  
[ElasticProperty(Name = "attach", Type = FieldType.Attachment,  
Store=true, TermVector = TermVectorOption.WithPositionsOffsets)]  
public string attach { get; set; }

and the query is the follwing  
{  
"fields" : ["name","attach"],  
"query" : {  
"query\_string" : {  
"query" : "settings"  
}  
},  
"highlight" : {  
"fields" : {  
"attach" : {}  
}  
}  
}

Do you have some idea?  
Thanks

Another thing that I found while using EA is the encode file,  
In fact, in the official "Attachment in Action" post,  
[http://www.elasticsearch.cn/tutorials/2011/07/18/attachment-type-in-action.html](http://www.elasticsearch.cn/tutorials/2011/07/18/attachment-type-in-action.html)  
first of all, it's under linux environment, and the commands used for  
encoding files depend on some perl scripts. Finally, the contain of the  
result encoded file seems to be different under a windows system and a  
linux system.  
Since I use .net framwork, the function that i used for encoding it's from  
c# api, convert.tobase64string.

Thank you very much!

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/14ca6c4e-1b2e-4fcd-980a-a375a54b1dd5%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/14ca6c4e-1b2e-4fcd-980a-a375a54b1dd5%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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:** [July 6, 2017, 12:59am UTC](https://discuss.elastic.co/t/question-client-net-nest-with-attachment-highlight-feature/19967/2 "2017-07-06T00:59:54Z")

</div>


