Update child's field by Update-mapping failed--nullpointerexception

Source: Internet
Author: User
Tags log log

When using Elasticsearch, it is necessary to use the Parent-child API to create a mapping for the parent, and a common nep--nullpointerexception occurs when the child's field fields are dynamically updated. The log log exception is as follows:

[2016-04-01 12:04:53,986] [INFO ] [rest.suppressed          ] /test/_mapping/name/  params: {index=test, type=name}java.lang.nullpointerexception         at org.elasticsearch.index.mapper.mappedfieldtype.checkcompatibility (MappedFieldType.java:246 )         at  Org.elasticsearch.index.mapper.internal.ParentFieldMapper.merge (parentfieldmapper.java:391)          at org.elasticsearch.index.mapper.mapping.merge (Mapping.java:113)          at org.elasticsearch.index.mapper.documentmapper.merge ( documentmapper.java:396)         at  Org.elasticsearch.cluster.metadata.metadatamappingservice$2.execute (metadatamappingservice.java:389)          at org.elasticsearch.clusTer.service.internalclusterservice$updatetask.run (internalclusterservice.java:388)          at org.elasticsearch.common.util.concurrent.prioritizedesthreadpoolexecutor$ Tiebreakingprioritizedrunnable.runandclean (prioritizedesthreadpoolexecutor.java:231)          at org.elasticsearch.common.util.concurrent.prioritizedesthreadpoolexecutor$ Tiebreakingprioritizedrunnable.run (prioritizedesthreadpoolexecutor.java:194)          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:745)

The head plugin displays the following content:

"Error": {"Root_cause": [{"Type": "Null_pointer_exception", "Reason": null}], "type": "Null_pointer_exception", " Reason ": null}," status ": 500}

The following actions are performed:

  1. Establishing the parent mapping

    Curl-xput localhost:9200/test-d '

    {

    "Mappings": {

    "User": {

    "Dynamic": true,

    "Properties": {

    "id": {"type": "String"},

    "Age": {"type": "String"},

    "Gender": {"type": "String"}

    }

    },

    "Name": {"_parent": {"type": "User"}}

    }

    } '

  2. Update Child mapping

    Curl-xput localhost:9200/test/_mapping/name-d '

    {
      ' name ': {
        ' properties ': {
          ' title ': {
          &NBS P; " Type: "string",
            "fields": {
              "first_name": {
    &nbs P           "type": "string"
             },
          &NBSP ;   "Last_Name": {
                "type": "Long"
             }        }
         }
       }
     }
    '  

    In the use of this exception is also no one, find the relevant documents and official instructions, and finally found a clue on Git, https://github.com/elastic/elasticsearch/issues/15997# issuecomment-171938807. There is a description of this problem found in Es, https://discuss.elastic.co/t/ UPDATING-CHILD-MAPPING-WITH-NEW-FIELD-FAILS-WITH-NULLPOINTEREXCEPTION/39256, the final question in this article is explained, https:// github.com/elastic/elasticsearch/pull/16013, originally this problem is es 2.1.x and 2.0.x version of the bug, but the official in 2.2 after the new version of the fix, but for the first link mentioned in the same _ Source issue, only seen in bug fixes in 2.3 of official documents. So the solution to the problem is to upgrade ES to the new version 2.3.

This article is from the "Do not forget Beginner's mind" blog, please be sure to keep this source http://zh9526.blog.51cto.com/3051209/1759227

Update child's field by Update-mapping failed--nullpointerexception

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.