A simple API integrating ElasticSearch for resource retrieval.
Run docker compose up -d to spin up the relevant containers.
First, set up the connection and index in appsettings.json, the index is the item you want to
add to ElasticSearch.
Then create the entity for that index, in this case, a Product.
After that, create some extensions for the index. This extension includes a default mapping that tells ElasticSearch the properties of the resource you want to ignore in search.
Next, create an Elastic client and register it for dependency injection as a singleton.
Then create the index itself, you have the entity, but ElasticSearch needs the index to work, so when ElasticSearch starts it checks whether the index exists, and creates it if not.
Then create the controller endpoints: one to search, one to add a product to ElasticSearch.
Note that the response will only include the fields you didn’t ignore, since id, price, and
description were ignored, those come back as 0 (the integer default).