Escaping dots

Hello guyz,

I'm trying to map a dynamic dictionary and i'm having problems with some keys.
Picture this example.

"systemvariables":{
"windows.user.home":"C:\Users\someuser",
"windows.user.home.desktop":"C:\Users\someuser\Desktop",
"windows.user.home.document":"C:\Users\someuser\Documents"
}

I get this error "Can't merge a non object mapping [buildvariables.windows.user.home] with an object mapping [buildvariables.windows.user.home]" because Elasticsearch is spliting my keys by the dots and indexing them hierarchically.

Meaning the first key:value pair is index as "text" but the second is mapped as an "object".

Is there a way to disable this behavior? Or a way to escape the dot character instead of a simple replace for "_"?

Thanks,

Dots are special syntax in field names. They represent hiearchy within the json data of the document. So windows.user.home is an object field called windows, containing an object field called user, containing a string field called home. When you then add windows.user.home.desktop, it expects windows.user.home to be an object field, but you already have it mapped as a string.

In your case the best thing to do is replace dot with some other character, like underscore as you suggested.

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