I have some json (below) that I need to index in elasticsearch:
{
"array": [
"item1",
{
"name": "item2"
}
]
}
When I try and index this type of json structure I get an error:
{
"error": "MapperParsingException[failed to parse [array]]; nested: ElasticsearchIllegalArgumentException[unknown property [name]]; ",
"status": 400
}
Now I understand that elasticsearch is getting confused because array contains stings type for item 1 and then an object for item2.
My question is, how would I define a mapping to handle this type of data?