I’ve been using osmosis tool to extract data inside a country in order to get a list of cities. Everything works just fine, I’m simply wondering why can’t I find address tags like county, country, state, postal_code in that file when I can found it using the osm_id in nominatim like this: https://nominatim.openstreetmap.org/reverse?format=xml&osm_id=46627665&osm_type=N
Nominatim does much, much more than a simple query of the tags. It analyzes the data with spatial queries (PostgreSQL/PostGIS) and determines in which polygon (country, state, country, zip code area, …) this object is located. And if such a polygon is not available (like zip code areas in many countries), it will try other algorithms.
This is not so easy with the raw data - nothing else you use.
Solution: Create a PostgreSQL/PostGIS database, fill it with raw data using osm2pgsql or osmconvert, and start your own queries.
Or: Install a local instance of nominatim on your servers and use that. (*)
Regards
walter
*) which requires installation of PostgreSQL/PostGIS and loading data with osm2pgsql.