The response structure seems okay, to me, which part of the first response is wrong in your opinion? I you have a document with "productcode" : "1992695" and "roles" : "ROLE_CUSTOMERGROUP,ROLE_PRONTO" it will turn up in both bucket. Is that the problem you are facing?