hello, anyone
i have a geo distance query function, and anyone can tell me how to realize it with elastichsearch.
hope replies. thank you
description:
there are lots of records, one record one line, every record has a field "positions"
the data format of "positions" is an array, the element is also an array, and it has three fields, first field is lat,
the second field is lon, the last field is distance, unit is meter, such as
"postitions" : [[125.3721,52.7839,50],[ 128.3799,52.7639,100]] , or "postitions": []
there is a request param {"lat":xxxxx, "lon":yyyy }, i hope it will calculate
the distance with postitions,
the process is:
1. calculate {"lat":xxxxx, "lon":yyyy } and the first element of postitions [125.3721,52.7839,50] , and the result distance is low to 50 the thrid filed of the first element, it matchs or , it not match
2. calculate {"lat":xxxxx, "lon":yyyy } and the second element of postitions [ 128.3799,52.7639,100] , and the result distance is low to 100 the thrid filed of the first element, it matchs or , it not match
3. element of postitions has only one match {"lat":xxxxx, "lon":yyyy } it will return the reocord
4. if postitions is empty, it will match any {"lat":xxxxx, "lon":yyyy } , and it will return the record