# Generic method for Document Properties creation

**URL:** <https://discuss.elastic.co/t/generic-method-for-document-properties-creation/130792>\
**Category:** Elasticsearch\
**Created:** [May 7, 2018, 7:46am UTC](https://discuss.elastic.co/t/generic-method-for-document-properties-creation/130792 "2018-05-07T07:46:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![arpansahoo](https://avatars.discourse-cdn.com/v4/letter/a/22d042/32.png) [@arpansahoo](https://discuss.elastic.co/u/arpansahoo)\
**Post date:** [May 7, 2018, 7:46am UTC](https://discuss.elastic.co/t/generic-method-for-document-properties-creation/130792/1 "2018-05-07T07:46:51Z")

</div>

Hi,  
For multi fields creation in NEST, I am using below approach (ElasticSearchProperties - is a class file having City, Email as strings) :-  
.Mappings(ms =\> ms.Map(m1 =\> m1  
.AutoMap()  
.AllField(af =\> af.Enabled(false))  
.Properties(p =\> p  
.Text(t =\> t  
.Name(n =\> n.City)  
.Index(false)  
.CopyTo(c =\> c.Field("Address"))  
)  
.Text(t =\> t  
.Name(n =\> n.Email)  
.Fields(f =\> f  
.Text(tt =\> tt  
.Name("Prefix")  
.Analyzer(BasicPrefixAnalyzer)  
.SearchAnalyzer(BasicAnalyzer)  
)  
)  
.Analyzer(BasicAnalyzer)  
)  
)  
)  
)

1. Is there a way by which I can create multifields (or sub fields, for example "Prefix" field above) using POCO?
2. Is there a way of creating a Generic method, to which I will pass attribute and it will create me properties for a document. Not necessary the above structure, it may be anything (like Sub field as Keyword etc etc)?

---

<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:** [June 4, 2018, 7:47am UTC](https://discuss.elastic.co/t/generic-method-for-document-properties-creation/130792/2 "2018-06-04T07:47:05Z")

</div>

Closed on June 4, 2018, 7:47am UTC

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