# Elasticsearch NEST client creating multi-field fields with completion

**URL:** <https://discuss.elastic.co/t/elasticsearch-nest-client-creating-multi-field-fields-with-completion/23632>\
**Category:** Elasticsearch\
**Created:** [May 17, 2015, 9:11am UTC](https://discuss.elastic.co/t/elasticsearch-nest-client-creating-multi-field-fields-with-completion/23632 "2015-05-17T09:11:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![redserpent7](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/redserpent7/32/467_2.png) [@redserpent7](https://discuss.elastic.co/u/redserpent7)\
**Post date:** [May 17, 2015, 9:11am UTC](https://discuss.elastic.co/t/elasticsearch-nest-client-creating-multi-field-fields-with-completion/23632/1 "2015-05-17T09:11:39Z")

</div>

I am trying to create some completion suggesters on some of my fields. My  
document class looks like this:

```
[ElasticType(Name = "rawfiles", IdProperty = "guid")]
public class RAW
{
[ElasticProperty(OmitNorms = true, Index = FieldIndexOption.NotAnalyzed, 

```

Type = FieldType.String, Store = true)]  
public string guid { get; set; }

```
[ElasticProperty(OmitNorms = true, Index = FieldIndexOption.Analyzed, 

```

Type = FieldType.String, Store = true, IndexAnalyzer = "def\_analyzer",  
SearchAnalyzer = "def\_analyzer\_search", AddSortField = true)]  
public string filename { get; set; }

```
[ElasticProperty(OmitNorms = true, Index = FieldIndexOption.Analyzed, 

```

Type = FieldType.String, Store = true, IndexAnalyzer = "def\_analyzer",  
SearchAnalyzer = "def\_analyzer\_search")]  
public List tags { get { return new List(); } }  
}

And here is how I am trying to create the completion fields

public bool CreateMapping(ElasticClient client, string indexName)  
{  
IIndicesResponse result = null;  
try  
{  
result = client.Map(  
c =\> c.Index(indexName)  
.MapFromAttributes()  
.AllField(f =\> f.Enabled(false))  
.SourceField(s =\> s.Enabled())  
.Properties(p =\> p  
.Completion(s =\> s.Name(n =\> n.tags.Suffix(  
"comp"))  
.IndexAnalyzer("standard")  
.SearchAnalyzer("standard")  
.MaxInputLength(20)  
.Payloads()  
.PreservePositionIncrements()  
.PreserveSeparators())  
.Completion(s2 =\> s2.Name(n=\>n.filename.Suffix(  
"comp"))  
.IndexAnalyzer("standard")  
.SearchAnalyzer("standard")  
.MaxInputLength(20)  
.Payloads()  
.PreservePositionIncrements()  
.PreserveSeparators())  
)  
);  
}  
catch (Exception)  
{

```
    }

    return result != null && result.Acknowledged;
}

```

My problem is that this is only creating a single completion field named  
"comp". I was under the impression that this will create two completion  
fields, one named filename.comp and the other named tags.comp.

I then tried the answer on this SO question  
[http://stackoverflow.com/questions/21433586/nest-suggestcompletion-usage-throws-is-not-a-completion-suggest-field-excepti](http://stackoverflow.com/questions/21433586/nest-suggestcompletion-usage-throws-is-not-a-completion-suggest-field-excepti)  
but this complicated the matter even worse as now my two fields were mapped  
as a completion field only.

Just to be clear, I want to create a multi-field (field) that has a data,  
sort and completion fileds. Much like the one in this example  
[https://developer.rackspace.com/blog/qbox/](https://developer.rackspace.com/blog/qbox/)

## -- Please update your bookmarks! We have moved to [https://discuss.elastic.co/](https://discuss.elastic.co/)

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/9ac2dd42-47d3-437d-a5cb-af405b4235a3%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/9ac2dd42-47d3-437d-a5cb-af405b4235a3%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:13am UTC](https://discuss.elastic.co/t/elasticsearch-nest-client-creating-multi-field-fields-with-completion/23632/2 "2017-07-06T00:13:43Z")

</div>


