Store selected JSON field as string


#1

I currently have two database columns which contain JSON as a
nvarchar(max). I need ElasticSearch to analyze one of them, but ignore
the other one so it will be stored as a string. Is this possible?

I tried the following mapping for the string-json:

"jsontest": {
    "type": "object",
    "enabled" : false
 },

And also:

"jsontest": {
    "type": "string",
    "index" : "not_analyzed"
 },

The first will still give me a JSON tree in elasticsearch. The latter gives a MapperParsingException:failed to parse to string


(Michael McCandless) #2

As long as you escape embedded double quotes inside the string that's actually a JSON string, you should be able to store that string value. ES will treat it as a string and not try to parse it as JSON.

Mike McCandless


(system) #3

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