Customizing elasticsearch indexes from Couchbase ES plugin

Hey all,
This is more a question with ElasticSearch, but it's only because the data is coming from Couchbase. Was wondering if any one else is more familiar with this than I am.
I'm trying to figure out how to customize our elasticsearch index that is being populated from the Couchbase ES XDCR plugin. Say I have a record in CB that looks like this:

{
  "className": "MyClass",
  "id": "d199c338196dd4b55b3d982383781fdf45701ed6",
  "data": {},
  "created_at": 1366930369,
  "updated_at": 1366930369,
  "version": 3,
  "type": "Blob",
  "acl": {}
}

I wanted to customize the index to leave out the "data" field since this is very different depending on the object. I was trying to create a new index with the following:

curl -XPUT localhost:9200/testindex/ -d '
{
    "settings": {
        "mappings": {
            "couchbaseDocument": {
                "properties": {
                    "doc": {
                        "properties": {
                            "data": {
                                "type": "object",
                                "enabled": "false"
                            }
                        }
                    }
                }
            }
        }
    }
}'

However, the "data" field is still getting indexed. Any ideas on how I should create the ES index to not include the "data" field?

Thanks,
-- Joel

1 Answer

« Back to question.

Figured it out. The mappings block needs to be a sibling of settings, not a child. The index should look like this:

curl -XPUT localhost:9200/testindex/ -d '
{
    "settings": {
        ...
    },
    "mappings": {
        "couchbaseDocument": {
            "properties": {
                "doc": {
                    "properties": {
                        "data": {
                            "type": "object",
                            "enabled": "false"
                        }
                    }
                }
            }
        }
    }
}'