https://github.com/cedadev/stac-fastapi-elasticsearch
Elasticsearch backend for the stac-fastapi server
https://github.com/cedadev/stac-fastapi-elasticsearch
Last synced: 10 months ago
JSON representation
Elasticsearch backend for the stac-fastapi server
- Host: GitHub
- URL: https://github.com/cedadev/stac-fastapi-elasticsearch
- Owner: cedadev
- Created: 2021-06-21T16:27:14.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-09-26T13:39:40.000Z (over 2 years ago)
- Last Synced: 2025-06-08T16:39:40.749Z (about 1 year ago)
- Language: Python
- Size: 399 KB
- Stars: 9
- Watchers: 8
- Forks: 3
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Elasticsearch Backend for the stac-fastapi server
[](https://github.com/cedadev/stac-fastapi-elasticsearch/actions/workflows/test.yml)
## Getting started
Copy settings.py.tmpl and remove the tmpl extension.
Fill in
- ELASTICSEARCH_HOST
- api_key
Create a virtualenv and install requirements
```bash
python -m venv venv
./venv/bin/activate
pip intall -r requirements.txt
```
## Running the development server
**Option 1 (virtual environment):**
This option makes use of traditional virtual environment. You might need to specify the path
to the uvicorn binary e.g. `/venv/bin/uvicorn` to make sure you are using the right environment.
```bash
export STAC_ELASTICSEARCH_SETTINGS=stac_fastapi.elasticsearch.settings
```
```bash
uvicorn stac_fastapi.elasticsearch.app:app --reload
```
**Option 2 (Docker):**
This option makes use of Docker compose and includes some sample data. It will start a local elasticsearch instance,
populate with some data and start the application which will reload if you modify the code or configuration.
```bash
make run-sample-elasticsearch
```
You can change the default settings by creating a file in `/conf/settings.d` and adding `include_dir(base_dir / 'settings.d')`
to `/conf/settings.py`
Here you can set:
- `ELASTICSEARCH_CONNECTION`
- `COLLECTION_INDEX`
- `ITEM_INDEX`
- `ASSET_INDEX`
You could use this to point at production or staging data instead of the local instance.
### Demo Application
You can use docker-compose to create a demo instance. This will create an elasticsearch node, add some sample data and run the API.
```bash
make run-sample-elasticsearch
```
**NOTE: You will need to build the image first** `docker-compose build`