Search code examples
elasticsearchreplicationcouchbase

How to solve the indexing error in couchbase elasticsearch replication?


I'm Trying to solve the issue while replicating my data from couchbase server to elasticsearch.

Error while replicating : Object mapping [place] trying to serialize a value with no field associated with it, current value [placeName]

My document is { "Name":"personname", "address":[], place:["placeName"], "zipCode" :"zipcode" }

If this document is changed like this it will work: {
"Name":"personname", "address":[], place:[], "zipCode" :"zipcode" }

I have used the same name place as object type in another document.

{
   "place":{
     "name":"",
     "otherfields":""
   }
}

But my problem is it never be empty sometimes contains value.

I have also tried this { "Name":"personname", "address":[], "place":[""], "zipCode" :"zipcode" } but getting the same issue.

Issue is with the same name mapped with different object types Object and other as string Of array.

I want to keep those 2 fields in different document.


Solution

  • This is caused by your ElasticSearch mappings. A field cannot have different data types within the same ES type. The correct solution is to use the type selector feature of the plugin to ensure that the different documents schemas are assigned to different ES types - this will prevent mapping conflicts.

    Here's an explanation of how to map different documents from CB to different ES types through the type selector feature of the transport plugin: http://docs.couchbase.com/admin/elastic/adv-usage.html (Scroll down to the section named "Setting document type")