Array attribute relations

took #3918 and added tests for elasticsearch.
Tests are only failing because of #4379.

@qiangxue what do you think? Imo this is good to merge.

fixes #1249, closes #3918, fixes #4379
thought about this but I see no reason to use array valued attribute if only one element is related. Do you have a use case for that?