Create a places API

(Arkkanoid) #1

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?

(Igor Motov) #2

What do you want to improve?

(David Pilato) #3

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. 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.

(system) closed #4

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