I'm new to Elasticsearch and trying to build a query that exceeds my novice Elasticsearch skills!
We have got a database with all major airports (+- 4.000). The fields that are relevant for search are:
- name (San Francisco International Airport )
- IATA code (SFO)
- ICAO code (KSFO)
- category (1-4)
- location (mapped as geo-point)
The goal is to create an autocomplete that allows users can find an airport quickly. Obviously, people should be able to find an airport by name. So far so good. Now for the interesting part: IATA and ICAO codes are commonly used to search for airports, so when typing 'SF', San Fransisco should pop up as the first result. Scores should be boosted for airports nearby (let's say within 200 km) and large airports (category 1). If a user is nearby San Fransisco and types an 'S', San Fransisco should pop up as the first result. Any ideas on how to build this query?
Also, when the user focuses on the autocomplete field but hasn't typed a letter yet, I would like to show them the 3 nearest airports. How would that query look like?
Many thanks in advance!