# Custom score with isolines

**URL:** <https://discuss.elastic.co/t/custom-score-with-isolines/50731>\
**Category:** Elasticsearch\
**Created:** [May 23, 2016, 2:50pm UTC](https://discuss.elastic.co/t/custom-score-with-isolines/50731 "2016-05-23T14:50:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nicom](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nicom/32/488_2.png) [@nicom](https://discuss.elastic.co/u/nicom)\
**Post date:** [May 23, 2016, 2:50pm UTC](https://discuss.elastic.co/t/custom-score-with-isolines/50731/1 "2016-05-23T14:50:45Z")

</div>

Hi there !,

We have 1M docs representing geolocalized polluting companies with the geographical diffusion of their pollution using isoline polygons

for instance  
[![](http://2.bp.blogspot.com/-aXeLo4ykrxc/T3juZYMm1SI/AAAAAAAAAA8/5RqL5dO4nXA/s400/isoline.png) ](http://2.bp.blogspot.com/-aXeLo4ykrxc/T3juZYMm1SI/AAAAAAAAAA8/5RqL5dO4nXA/s400/isoline.png)

to simplify we use rectangular area , check this drawing

> **[Polygone / isoline](https://docs.google.com/drawings/d/1hdwD4XN761Qp4zSa0STLAGTWD-auLiH6dNykoBz5qZE/edit?usp=sharing)**
>
> 10\_degree\_isoline 20\_degree\_isoline 30\_degree\_isoline geolocalised object DATA GENERATION (TOP 10 Company less polluting near a given point) A GIVEN POINT 1 Company 1 Company 2 We PREFER Company 1 (matching 10 degree isoline) than company 2 (matching...

We currently have the following mapping (you can change it if you think it's not relevant for the pb)  
doc ={

- 10units\_isoline = polygon # the area where the pollution generated by this company is about 10 units
- 20units\_isoline = polygon # the area where the pollution generated by this company is about 20 units
- 30units\_isoline = polygon# the area where the pollution generated by this company is about 30 units
- ..  
}

I dont manage to find the query to retrieve the top 10 companies that are the less polluting near a given point. In our context, we prefer documents where the queried point matches the polygon of the 10units\_isoline field more than a polygon of the 30units\_isoline field of another doc.

More specially (this is the difficult part) when we retrieve the TOP 10 document I want to know for each document what is the associated pollution isoline of this company at that particular point.

any direction / suggestion / similar examples where to search to get

(is ES the right tool for such query?)

Thanks in advance !

Nicolas

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 5, 2017, 10:49pm UTC](https://discuss.elastic.co/t/custom-score-with-isolines/50731/2 "2017-07-05T22:49:46Z")

</div>

Closed on July 5, 2017, 10:49pm UTC


