Can't filter on array of arrays
See original GitHub issueHello guys,
I have a JSON like this :
{ "_source": { "Asset": [ { "Ref": [ { "string": [ "1358420" ], "@field": "REF" } ], "ImageType": [ [ { "string": "Image", "@code": "ImageType-DAM_MTYP_IMAGE", "@field": "IMAGE_TYPE" } ], [ { "string": "Packshot", "@code": "ImageType-DAM_MTYP_3014", "@field": "IMAGE_TYPE" } ] ] }, { "Ref": [ { "string": [ "896_1" ], "@field": "REF" } ], "ImageType": [ [ { "string": "Product Photo", "@code": "ImageType-DAM_MTYP_3011", "@field": "IMAGE_TYPE" } ], [ { "string": "Packshot", "@code": "ImageType-DAM_MTYP_3014", "@field": "IMAGE_TYPE" } ] ] } ] } }
I have to filter the assets on Ref and ImageType code. I’m using this filter for the Ref : Filter refFilter = Filter.filter(where(“Ref[0].string[0]”).is(“1358420”)); parse(json).read(“_source.Asset[?]”, refFilter); This is working.
Now for the ImageType code : Filter imageTypeFilter = Filter.filter(where(“ImageType[0][0].@code”).is(“ImageType-DAM_MTYP_IMAGE”)); This is working.
However, Filter imageTypeFilter = Filter.filter(where(“ImageType[0][1].@code”).is(“ImageType-DAM_MTYP_3014”)); This doesn’t work. Can you tell me why please ? Is it a problem in my code or is there a bug ? Thank you in advance for your answer. I’m struggling with this for hours…
Regards
Issue Analytics
- State:
- Created 5 years ago
- Comments:8
Top GitHub Comments
Done. Sorry I tried to simplify it at the maximum. The original one is more than 11000 lines !
Regardless of the JsonPath implementation and limitations, in these cases the appropriate indexes are [1][0] and not [0][1] for what you are searching for.