0

Please find the below mapping, We are trying to updated the domains field inside the domains type.

 "mappings":{  
   "candidate":{  
      "_all":{  
         "enabled":false
      },
      "properties":{  
         "domains":{  
            "properties":{  
               "country":{  
                  "type":"short",
                  "include_in_all":false
               },
               "domains":{  
                  "type":"string",
                  "copy_to":[  
                     "domain_exact",
                     "domain_partial"
                  ]
               }
            }
         }
      }
   }
}

And the java code given below,

esMgr.updateIndex(indexName, "candidate", domainDetails[2]).setDoc("domains.domains", domainDetails[1])
                                .get();

We are getting the below exception,

Caused by: MapperParsingException[Field name [domains.domains] cannot contain '.'] 

Can anyone help us on how to fix this issue in java.

Sabir Khan
  • 9,826
  • 7
  • 45
  • 98
banu
  • 31
  • 1
  • 1
  • 6

1 Answers1

0

To update, you can try:

UpdateRequestBuilder br = client.prepareUpdate(indexName, "candidate", domainDetails[2]);
br.setDoc("{\"domains\":{ \"domains\": " + domainDetails[1] + "}}".getBytes());
br.execute();
SDekov
  • 9,276
  • 1
  • 20
  • 50