Object field starting or ending with a [.] makes object resolution ambiguous

(Phillipp Ohlandt) #1


I want to index a nested array. It works fine for some of my data, but sometimes I get the error from the title.

The string it complains on (which is an array key):

Ask Questions\n\nJoin the discussion...\n\n \n\nRichard Wigley\n\nI'm confused about the calling of the length recursion base case: so 'defp length ], count)' vs 'defp\nlength([_|t], count)' and | am assuming that Elixir pattern matches the 'defp length([ J, count)' function when\nthe list is empty and pattern matches 'defp length([_]t], count)' when it has an element? I'm throwing in the\nterm 'pattern matching' here but I don't understand it as | am used to functions matching on argument type.\n1 a _ v- Reply - Share\n\nDaniel Berkompas ~ยป Richard Wigley\n\n& Elixir is different from many programming languages in how it decides which version of a function to\ncall. It calls the first version of a function where the arguments _match_ the pattern in the function\ndefinition. This allows you to be much more specific than a statically typed language. For example, as\nshown in this episode, you can run a given function definition only in the case where the list is empty.\n\nI talk more about this in the previous episode on Control Flow. https://www.learnelixirtw/epi...\n1 m ~ > Reply - Share:

Some additional info from the error:

type: illegal_argument_exception
reason: failed to parse
root_cause: [%{reason: "failed to parse", type: "mapper_parsing_exception"}]
status: 400

I am not sure what's wrong. I mean, it's just a string.

(Zachary Tong) #2

I suspect something isn't being escaped correctly. That exception basically means that a field or object name is starting/ending with a period. So if the string isn't properly escaped for JSON, the parser is interpreting parts of it as the next field/key/name in the JSON object and throwing a fit.

Can you paste the full JSON body that is being sent to ES?

(Phillipp Ohlandt) #3

The posted string is pasted from the error message. There shouldn't be any escaping errors because it's not user-entered and I can successfully dump my dataset to a json file. I can post the full dataset as json tomorrow when I am on my working machine again.

(system) #4

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