I have this json object
{
"index": {
"queryString": "",
"filtersMap": {},
"selectedFilters": [],
"queries": [
{
"filtered": {
"filter": {
"bool": {
"must": [
{
"term": {
"listingRecordState.id": "3"
}
},
{
"geo_distance": {
"distance": "100mi",
"property.location": {
"lat": "40.7608",
"lon": "-111.8910"
}
}
}
]
}
}
}
}
],
"filters": [],
"_source": null,
"size": 9
},
"query": {
"query": {
"filtered": {
"filter": {
"bool": {
"must": [
{
"term": {
"listingRecordState.id": "3"
}
},
{
"geo_distance": {
"distance": "100mi",
"property.location": {
"lat": "40.7608",
"lon": "-111.8910"
}
}
}
]
}
}
}
},
"size": 9
}
}
I need to be able to update the lat and long inside this object without knowing the exact path, because the index inside each array could potentially change.
There will only be one key of "lat" and one key of "long" so duplicate key names will not be a problem.
I have tried several solutions using loops and recursion but have not been able to create or find something that works.
Thanks!