# Completion mapping type throws a misleading error on null value

**URL:** <https://discuss.elastic.co/t/completion-mapping-type-throws-a-misleading-error-on-null-value/17580>\
**Category:** Elasticsearch\
**Created:** [May 18, 2014, 8:40pm UTC](https://discuss.elastic.co/t/completion-mapping-type-throws-a-misleading-error-on-null-value/17580 "2014-05-18T20:40:06Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Glade\_Luco](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/glade_luco/32/1560_2.png) [@Glade\_Luco](https://discuss.elastic.co/u/Glade_Luco)\
**Post date:** [May 18, 2014, 8:40pm UTC](https://discuss.elastic.co/t/completion-mapping-type-throws-a-misleading-error-on-null-value/17580/1 "2014-05-18T20:40:06Z")

</div>

I'm implementing an autocomplete feature using the new(ish) completion  
type. We are implementing it against a series of fields, and in some  
cases one of the fields is null. When the field is null, the completion  
mapping parser throws an error but it refers to the next field in the  
document, not the field with the completion type.

I created a simple Gist to demonstrate the problem.

> <https://gist.github.com/glade-at-gigwell/6408e0e4b69ddf2e8856>

--  
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/e42cb0c9-d97e-4448-8257-5512865cc42f%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/e42cb0c9-d97e-4448-8257-5512865cc42f%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Glade\_Luco](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/glade_luco/32/1560_2.png) [@Glade\_Luco](https://discuss.elastic.co/u/Glade_Luco)\
**Post date:** [May 18, 2014, 8:41pm UTC](https://discuss.elastic.co/t/completion-mapping-type-throws-a-misleading-error-on-null-value/17580/2 "2014-05-18T20:41:05Z")

</div>

bash repro.sh

{"acknowledged":true}[2014-05-18 13:40:24,150][INFO][cluster.metadata  
] [Aelfyre Whitemane] [completion\_type\_cant\_handle\_the\_null\_truth]  
creating index, cause [api], shards [1]/[0], mappings   
{"acknowledged":true}[2014-05-18 13:40:24,224][INFO][cluster.metadata  
] [Aelfyre Whitemane] [completion\_type\_cant\_handle\_the\_null\_truth]  
create\_mapping [object]  
{"acknowledged":true}[2014-05-18 13:40:24,245][INFO][cluster.metadata  
] [Aelfyre Whitemane] [completion\_type\_cant\_handle\_the\_null\_truth]  
update\_mapping [object] (dynamic)  
{"\_index":"completion\_type\_cant\_handle\_the\_null\_truth","\_type":"object","\_id":"1","\_version":1,"created":true}[2014-05-18  
13:40:24,265][DEBUG][action.index] [Aelfyre Whitemane]  
[completion\_type\_cant\_handle\_the\_null\_truth][0],  
node[k4lbsgzYSlWzynQkVGqMaw], [P], s[STARTED]: Failed to execute [index  
{[completion\_type\_cant\_handle\_the\_null\_truth][object][2], source[{"field1"  
: null,"field2" : "nulls make me sad"}]}]  
org.elasticsearch.index.mapper.MapperParsingException: failed to parse  
at  
org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:540)  
at  
org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:462)  
at  
org.elasticsearch.index.shard.service.InternalIndexShard.prepareIndex(InternalIndexShard.java:384)  
at  
org.elasticsearch.action.index.TransportIndexAction.shardOperationOnPrimary(TransportIndexAction.java:203)  
at  
org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$AsyncShardOperationAction.performOnPrimary(TransportShardReplicationOperationAction.java:556)  
at  
org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$AsyncShardOperationAction$1.run(TransportShardReplicationOperationAction.java:426)  
at  
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)  
at  
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)  
at java.lang.Thread.run(Thread.java:744)  
Caused by: org.elasticsearch.ElasticsearchIllegalArgumentException: Unknown  
field name[field2], must be one of [payload, input, weight, output]  
at  
org.elasticsearch.index.mapper.core.CompletionFieldMapper.parse(CompletionFieldMapper.java:237)  
at  
org.elasticsearch.index.mapper.object.ObjectMapper.serializeNullValue(ObjectMapper.java:505)  
at  
org.elasticsearch.index.mapper.object.ObjectMapper.parse(ObjectMapper.java:465)  
at  
org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:515)  
... 8 more  
{"error":"MapperParsingException[failed to parse]; nested:  
ElasticsearchIllegalArgumentException[Unknown field name[field2], must be  
one of [payload, input, weight, output]];  
","status":400}MacBook-Boss:completionmapping glade$

On Sunday, May 18, 2014 1:40:06 PM UTC-7, Glade Luco wrote:

> I'm implementing an autocomplete feature using the new(ish) completion  
> type. We are implementing it against a series of fields, and in some  
> cases one of the fields is null. When the field is null, the completion  
> mapping parser throws an error but it refers to the next field in the  
> document, not the field with the completion type.
> 
> I created a simple Gist to demonstrate the problem.
> 
> [https://gist.github.com/glade-at-gigwell/6408e0e4b69ddf2e8856](https://gist.github.com/glade-at-gigwell/6408e0e4b69ddf2e8856)

--  
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/d47721f2-1798-4dba-b88f-3b923db037dc%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/d47721f2-1798-4dba-b88f-3b923db037dc%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![gquintana](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gquintana/32/48441_2.png) [@gquintana](https://discuss.elastic.co/u/gquintana)\
**Post date:** [August 25, 2014, 11:51am UTC](https://discuss.elastic.co/t/completion-mapping-type-throws-a-misleading-error-on-null-value/17580/3 "2014-08-25T11:51:12Z")

</div>

Hello,

I am experiencing the same problem: I am indexing a field (libelleVoie)  
with a mapping of type completion, but this field is sometimes null, and  
then I get this error:

[2014-08-25 13:16:49,500][DEBUG][action.bulk] [gqa-es-node-1]  
[fiche\_immeuble][4] failed to execute bulk item (index) index  
{[fiche\_immeuble][terrain][0200000002],  
source[{"id":350,"numero":"0200000002","numeroVoie":null,"libelleVoie":null,"commune":{"codePostal":"02130","codeInsee":"02127","libelle":"BRUYERES  
SUR FERE"}}]}  
org.elasticsearch.index.mapper.MapperParsingException: failed to parse  
at  
org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:536)  
at  
org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:462)  
at  
org.elasticsearch.index.shard.service.InternalIndexShard.prepareIndex(InternalIndexShard.java:394)  
at  
org.elasticsearch.action.bulk.TransportShardBulkAction.shardIndexOperation(TransportShardBulkAction.java:413)

```
    at 

```

org.elasticsearch.action.bulk.TransportShardBulkAction.shardOperationOnPrimary(TransportShardBulkAction.java:155)  
at  
org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$AsyncShardOperationAction.performOnPrimary(TransportShardReplicationOperationAction.java:534)  
at  
org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$AsyncShardOperationAction$1.run(TransportShardReplicationOperationAction.java:433)  
at  
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)  
at  
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)  
at java.lang.Thread.run(Thread.java:744)  
Caused by: org.elasticsearch.ElasticsearchIllegalArgumentException: Unknown  
field name[commune], must be one of [context, payload, input, weight,  
output]  
at  
org.elasticsearch.index.mapper.core.CompletionFieldMapper.parse(CompletionFieldMapper.java:256)  
at  
org.elasticsearch.index.mapper.core.AbstractFieldMapper$MultiFields.parse(AbstractFieldMapper.java:927)  
at  
org.elasticsearch.index.mapper.core.AbstractFieldMapper.parse(AbstractFieldMapper.java:422)  
at  
org.elasticsearch.index.mapper.object.ObjectMapper.serializeNullValue(ObjectMapper.java:526)  
at  
org.elasticsearch.index.mapper.object.ObjectMapper.parse(ObjectMapper.java:486)  
at  
org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:515)  
... 9 more

Is there a worlaround (using ES 1.2.2)?

Gérald

--  
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/104f8954-cebf-4def-aff1-56342ca0b80b%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/104f8954-cebf-4def-aff1-56342ca0b80b%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![gquintana](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gquintana/32/48441_2.png) [@gquintana](https://discuss.elastic.co/u/gquintana)\
**Post date:** [August 25, 2014, 12:41pm UTC](https://discuss.elastic.co/t/completion-mapping-type-throws-a-misleading-error-on-null-value/17580/4 "2014-08-25T12:41:09Z")

</div>

Replacing null by " " (espace) does the job.

Gérald

Le lundi 25 août 2014 13:51:12 UTC+2, Gérald Quintana a écrit :

> Hello,
> 
> I am experiencing the same problem: I am indexing a field (libelleVoie)  
> with a mapping of type completion, but this field is sometimes null, and  
> then I get this error:
> 
> [2014-08-25 13:16:49,500][DEBUG][action.bulk]  
> [gqa-es-node-1] [fiche\_immeuble][4] failed to execute bulk item (index)  
> index {[fiche\_immeuble][terrain][0200000002],  
> source[{"id":350,"numero":"0200000002","numeroVoie":null,"libelleVoie":null,"commune":{"codePostal":"02130","codeInsee":"02127","libelle":"BRUYERES  
> SUR FERE"}}]}  
> org.elasticsearch.index.mapper.MapperParsingException: failed to parse  
> at  
> org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:536)  
> at  
> org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:462)  
> at  
> org.elasticsearch.index.shard.service.InternalIndexShard.prepareIndex(InternalIndexShard.java:394)  
> at  
> org.elasticsearch.action.bulk.TransportShardBulkAction.shardIndexOperation(TransportShardBulkAction.java:413)
> 
> ```
> at 
> 
> ```
> 
> org.elasticsearch.action.bulk.TransportShardBulkAction.shardOperationOnPrimary(TransportShardBulkAction.java:155)  
> at  
> org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$AsyncShardOperationAction.performOnPrimary(TransportShardReplicationOperationAction.java:534)  
> at  
> org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$AsyncShardOperationAction$1.run(TransportShardReplicationOperationAction.java:433)  
> at  
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)  
> at  
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)  
> at java.lang.Thread.run(Thread.java:744)  
> Caused by: org.elasticsearch.ElasticsearchIllegalArgumentException:  
> Unknown field name[commune], must be one of [context, payload, input,  
> weight, output]  
> at  
> org.elasticsearch.index.mapper.core.CompletionFieldMapper.parse(CompletionFieldMapper.java:256)  
> at  
> org.elasticsearch.index.mapper.core.AbstractFieldMapper$MultiFields.parse(AbstractFieldMapper.java:927)  
> at  
> org.elasticsearch.index.mapper.core.AbstractFieldMapper.parse(AbstractFieldMapper.java:422)  
> at  
> org.elasticsearch.index.mapper.object.ObjectMapper.serializeNullValue(ObjectMapper.java:526)  
> at  
> org.elasticsearch.index.mapper.object.ObjectMapper.parse(ObjectMapper.java:486)  
> at  
> org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:515)  
> ... 9 more
> 
> Is there a worlaround (using ES 1.2.2)?
> 
> Gérald

--  
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/c61f3b19-0d99-4bf3-b72a-a1cf0bc67534%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/c61f3b19-0d99-4bf3-b72a-a1cf0bc67534%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, 1:06am UTC](https://discuss.elastic.co/t/completion-mapping-type-throws-a-misleading-error-on-null-value/17580/5 "2017-07-06T01:06:42Z")

</div>


