Object mapping

I have a situation in which for one object I can have more than one node which has the same name. However, each node may be different by additional attributes "IsUpdated, “IsAdded”. It is also possible that the node doesn’t have any attentional attributes.

I would like to divide this object into two objects where one will have only nodes which have attribute “IsUpdated” and the second IsAdded.

So 1 document will have
<peci:Position peci:isUpdated>
<peci:Compensation peci:isUpdated>
<peci:Compensation_Plans peci:isUpdated>

second document will have:

<peci:Position peci:IsAdded>
<peci:Compensation peci:IsAdded>
<peci:Compensation_Plans peci:IsAdded>
<peci:Collective_Agreement peci:IsAdded>

To do it I tried to use some elastic mapping $…[?(value.hasOwnProperty(’@peci:isAdded’) )] but it doesn’t work. I would appreciate your help on this.