# Completion type & multi-type dynamic template

**URL:** <https://discuss.elastic.co/t/completion-type-multi-type-dynamic-template/13552>\
**Category:** Elasticsearch\
**Created:** [September 11, 2013, 10:02am UTC](https://discuss.elastic.co/t/completion-type-multi-type-dynamic-template/13552 "2013-09-11T10:02:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jilles\_van\_Gurp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jilles_van_gurp/32/879_2.png) [@Jilles\_van\_Gurp](https://discuss.elastic.co/u/Jilles_van_Gurp)\
**Post date:** [September 11, 2013, 10:02am UTC](https://discuss.elastic.co/t/completion-type-multi-type-dynamic-template/13552/1 "2013-09-11T10:02:28Z")

</div>

I'm playing with the new completion functionality as introduced here:

> **[You Complete Me
	  	 | Elastic](https://www.elastic.co/blog/you-complete-me)**
>
> Effective search is not just about returning relevant results when a user types in a search phrase, it's also about helping your user to choose the best search phrases. Elasticsearch already has did-y...

For this, I'm running a fresh build straight of es master with the new  
functionality.

In my data, the json includes things like this:

"name":{"it":["Berlino"],"de":["Berlin", "Stadt Berlin"]}

So, it is an object with language -\> list of translations. If I index with  
a dynamic mapping, I would end up with the fields name.it and [name.de](http://name.de)

Instead, I'm trying to use dynamic templates and multi\_field together to do  
this:

```
    "dynamic_templates": [
        {
            "name_string": {
                "path_match": "name.*",
                "match_mapping_type": "string",
                "mapping": {
                    "type": "multi_field",
                    "path": "just_name",
                    "fields": {
                        "name_value": {
                            "type" : "string", 
                            "index" : "analyzed"
                        },
                        "name_completion": {
                            "type" : "completion"
                        },                            
                        "{name}": { 
                            "type" : "string", 
                            "index" : "analyzed"
                        },
                        "name_value_na": { 
                            "type" : "string", 
                            "index" : "not_analyzed"
                        }
                    }
                }
            }
        }

```

The intention is to have my different name translations indexed in several  
ways:

a name\_value field that indexes all language strings regardless of their  
language. (I'm using the icu plugin and have that configured as the default  
analyzer elsewhere)  
a name\_value\_na field that indexes all language strings regardless of their  
mapping but without the analyzer.  
a name. field for which I plan to have language specific analysis  
eventually.  
a name\_completion that uses the new suggestions functionality (I'm building  
directly from master & updated this morning)

My problem is with the completion field:

11:46:02.342 [elasticsearch[localnode][refresh][T#1]] WARN index.codec -  
[localnode] [locations] no index mapper found for field:  
[name.de.name\_completion] returning default postings format

It seems to be trying to create a name..name\_completion instead  
of the name\_completion despite the fact that I specified "path":  
"just\_name". Is this a bug or am I doing something wrong here?

Jilles

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)\
**Post date:** [September 11, 2013, 6:42pm UTC](https://discuss.elastic.co/t/completion-type-multi-type-dynamic-template/13552/2 "2013-09-11T18:42:03Z")

</div>

Looks like a bug [CompletionFieldMapper ignores path: just\_name · Issue #3669 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/3669)

On Wednesday, September 11, 2013 6:02:28 AM UTC-4, Jilles van Gurp wrote:

> I'm playing with the new completion functionality as introduced here:  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/blog/you-complete-me/)
> 
> For this, I'm running a fresh build straight of es master with the new  
> functionality.
> 
> In my data, the json includes things like this:
> 
> "name":{"it":["Berlino"],"de":["Berlin", "Stadt Berlin"]}
> 
> So, it is an object with language -\> list of translations. If I index with  
> a dynamic mapping, I would end up with the fields name.it and [name.de](http://name.de)
> 
> Instead, I'm trying to use dynamic templates and multi\_field together to  
> do this:
> 
> ```
> "dynamic_templates": [
> {
> "name_string": {
> "path_match": "name.*",
> "match_mapping_type": "string",
> "mapping": {
> "type": "multi_field",
> "path": "just_name",
> "fields": {
> "name_value": {
> "type" : "string", 
> "index" : "analyzed"
> },
> "name_completion": {
> "type" : "completion"
> },                            
> "{name}": { 
> "type" : "string", 
> "index" : "analyzed"
> },
> "name_value_na": { 
> "type" : "string", 
> "index" : "not_analyzed"
> }
> }
> }
> }
> }
> 
> ```
> 
> The intention is to have my different name translations indexed in several  
> ways:
> 
> a name\_value field that indexes all language strings regardless of their  
> language. (I'm using the icu plugin and have that configured as the default  
> analyzer elsewhere)  
> a name\_value\_na field that indexes all language strings regardless of  
> their mapping but without the analyzer.  
> a name. field for which I plan to have language specific  
> analysis eventually.  
> a name\_completion that uses the new suggestions functionality (I'm  
> building directly from master & updated this morning)
> 
> My problem is with the completion field:
> 
> 11:46:02.342 [elasticsearch[localnode][refresh][T#1]] WARN index.codec -  
> [localnode] [locations] no index mapper found for field:  
> [name.de.name\_completion] returning default postings format
> 
> It seems to be trying to create a name..name\_completion instead  
> of the name\_completion despite the fact that I specified "path":  
> "just\_name". Is this a bug or am I doing something wrong here?
> 
> Jilles

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:17am UTC](https://discuss.elastic.co/t/completion-type-multi-type-dynamic-template/13552/3 "2017-07-06T02:17:05Z")

</div>

Closed on July 6, 2017, 2:17am UTC


