Writing updateMapping method() - odd error returned by ES

Hi all,

I'm trying to write a method where I can update the mapping of an ElasticSearch index directly from visual studio. I have the mappings stored in json files in my project on visual studio. I import whatever particular mapping I need to update and attempt to post it via a C# curl method. In my method I'm also creating a new index with my new mapping. Upon attempting to create a new index with the new mapping, this error is returned: "{\n "error" : {\n "root_cause" : [\n {\n "type" : "class_cast_exception",\n "reason" : "java.lang.String cannot be cast to java.util.Map"\n }\n ],\n "type" : "class_cast_exception",\n "reason" : "java.lang.String cannot be cast to java.util.Map"\n },\n "status" : 500\n}\n"

This is not that descriptive of an error so I am not really sure where to look for the problem that is causing this error message to be returned. Any insight would be much appreciated!

Can you paste the mapping you are trying to use? It sounds like you supplied a string in a location that ES was expecting a JSON object (which is basically a map, hence the error)

Hi Zachary,

You are correct. I fixed it by moving the string and putting a JSON object there. Thank you though!

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.