mattbaird/elastigo

PutMappingFromJSON JSON object?

Closed this issue · 3 comments

Hi Matt,

I'm trying to use the PutMappingFromJSON method to create an index mapping, but no matter what I try to send, JSON-wise, I keep getting back:

Error [MapperParsingException[malformed mapping no root object found]] Status [400]

This is what I feel like the JSON should be:

{
    "institution" : {
        "properties" : {
            "name": {
                "type":     "string",
                "analyzer": "english",
                "fields": {
                    "raw": {
                        "type":  "string",
                        "index": "not_analyzed"
                    }
                }
            }
        }
    }
}

What am I missing?

Never mind. I think I was doing something stupid. First time that's ever happened.

@neocortical you need to close the issue if you found the fix.

I got this error and here is the mistake I made. I wanted to create an index with empty mappings in a JSON and left body to an empty object which elasticsearch complained about. I fixed it by putting the correct structure (still empty):

        "index_type_name": {
          "properties": {
          }
        }

that did the trick!

Sorry, @ambodi, I should have closed this as a Layer 8 issue.