N
N
Narek2015-03-16 19:38:43
PHP
Narek, 2015-03-16 19:38:43

How to implement address lookup in ElasticSearch?

Greetings friends!
I am making a service for finding addresses in Russia, based on the FIAS database ( fias.nalog.ru/Public/DownloadPage.aspx )
Mapping: https://yadi.sk/i/XsVbhbgNfHozp
There are 5 types of documents:
Region (region), level 1
District (district), level 3
Settlement (locality), level 4, 5 and 6
Street (street), level 7
House (house)
There are 2 more types of documents, these are country and address_object_type, the first one is not used yet, but I think in the future expand the database of addresses. The address_object_type stores the socrbase.DBF table from FIAS.
The task is to find the full address in the entire database.
The full address should look something like this: Country, region, district, locality, street, house
So far, I solved this problem as follows: I created a new address document type in elasticsearch. For each house entry, I write a house entry in address with links to the region, district, us. point, street, house and one more fullTitle field, which contains the full address. And, as you may have guessed, the search is performed only on the fullTitle field.
I would like to get rid of the address document and search for the address in the entire database at once.
Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
MintTea, 2015-03-29
@MintTea

I did something similar using elastic and fias, I can leave a couple of comments:
1. In elastic, data is usually stored in a denormalized form, and this is normal. In this case, you don’t need to get rid of the address type, even more - this is the only option with which you can at least find something in your index (read how TF / IDF is built to evaluate relevance)
2. Full-text search by addresses is a dubious solution . Filters should be applied here.
3. Fias is trash and waste. We *fought with it for half a year and ended up throwing it away, switching to our own database / location model

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question