2023-09-28 19:57:55 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
LAT=$1
|
|
|
|
LON=$2
|
|
|
|
|
|
|
|
if [[ "${LON}" && "${LAT}" ]]; then
|
|
|
|
curl -sk -XPOST 'https://data.gchange.fr/market/record/_search?pretty&_source=title' -d '
|
|
|
|
{
|
|
|
|
"size": 100,
|
|
|
|
"query": {
|
|
|
|
"bool": {
|
2024-03-04 12:33:42 +01:00
|
|
|
filter: [
|
|
|
|
{ term: { type: "offer" } }
|
|
|
|
,{
|
|
|
|
range: {
|
|
|
|
"stock": {
|
|
|
|
gte: 1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
,{
|
|
|
|
|
|
|
|
range: {
|
|
|
|
price: {
|
|
|
|
gt: 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
, must: {
|
2023-09-28 19:57:55 +02:00
|
|
|
match_all: {}
|
|
|
|
},
|
|
|
|
"filter": [{
|
|
|
|
"geo_distance": {
|
|
|
|
"distance": "50km",
|
|
|
|
"geoPoint": {
|
|
|
|
"lat": '${LAT}',
|
|
|
|
"lon": '${LON}'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}' | jq
|
|
|
|
else
|
|
|
|
echo "Aucune coordonnées. Indiquez LAT LON à votre requete"
|
|
|
|
fi
|