# Create a places API

**URL:** <https://discuss.elastic.co/t/create-a-places-api/135171>\
**Category:** Elasticsearch\
**Created:** [June 8, 2018, 2:33pm UTC](https://discuss.elastic.co/t/create-a-places-api/135171 "2018-06-08T14:33:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![arkkanoid](https://avatars.discourse-cdn.com/v4/letter/a/4491bb/32.png) [@arkkanoid](https://discuss.elastic.co/u/arkkanoid)\
**Post date:** [June 8, 2018, 2:33pm UTC](https://discuss.elastic.co/t/create-a-places-api/135171/1 "2018-06-08T14:33:22Z")

</div>

Hi,  
I need to transform a text about a place (i.e. Copenhagen , Capital Region, Denmark) in a structured data:  
{  
"professionals": 15644,  
"elevation": "",  
"name": "Copenhagen",  
"modification\_date": "2012-11-26",  
"country": "Denmark",  
"feature\_class": "P",  
"admin3\_code": "",  
"admin2\_code": "101",  
"cc2": "",  
"timezone": "Europe/Copenhagen",  
"feature\_code": "PPLC",  
"dem": "14",  
"country\_code": "DK",  
"admin1\_code": "17",  
"alternatenames": "CPH,Cobanhavan,Copenaga,Copenaghen,Copenaguen,Copenhaga,Copenhagen,Copenhague,Copenhaguen",  
"asciiname": "Copenhagen",  
"population": "1153615"  
}

I've the database to do that, but the results I get are far from perfection.

Currently I use:

```
		    "query": {
		        "function_score": {
				      "query": { 
				    "query_string" : {
				      "query": "Copenhagen OR (Capital Region) OR Denmark", 
				      "fields": ["name", "country", "alpha-2", "alternatenames"] ,
				      "use_dis_max" : True
				    }
				      },
		            "functions": [{
		                "field_value_factor": { 
		                    "field": "population"
		                }
		            }],
		            "score_mode": "multiply"
		        }
		    }

```

Suggestions to improve it?

---

<div class="post-metadata">

**Author:** ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)\
**Post date:** [June 8, 2018, 3:56pm UTC](https://discuss.elastic.co/t/create-a-places-api/135171/2 "2018-06-08T15:56:38Z")

</div>

> [@arkkanoid](#):
>
> Suggestions to improve it?

What do you want to improve?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [June 8, 2018, 4:55pm UTC](https://discuss.elastic.co/t/create-a-places-api/135171/3 "2018-06-08T16:55:28Z")

</div>

I'm like @Igor_Motov and curious.

> but the results I get are far from perfection.

What do you mean? What kind of results do you have?

Could you provide a full recreation script as described in [About the Elasticsearch category](https://discuss.elastic.co/t/about-the-elasticsearch-category/21). It will help to better understand what you are doing. Please, try to keep the example as simple as possible.

A full reproduction script will help readers to understand, reproduce and if needed fix your problem. It will also most likely help to get a faster answer.

---

<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 6, 2018, 5:03pm UTC](https://discuss.elastic.co/t/create-a-places-api/135171/4 "2018-07-06T17:03:56Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
