From 866d45c58194d591231b6f27ab41c79378bf4eef Mon Sep 17 00:00:00 2001 From: jonhealy1 Date: Thu, 28 Mar 2024 01:20:38 +0800 Subject: [PATCH 1/9] add notes to get started --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index a6d04609..7f5f8ea6 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,8 @@ - Our Api core library can be used to create custom backends. See [stac-fastapi-mongo](https://github.com/Healy-Hyperspatial/stac-fastapi-mongo) for a working example. - Reach out on our [Gitter](https://app.gitter.im/#/room/#stac-fastapi-elasticsearch_community:gitter.im) channel or feel free to add to our [Discussions](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/discussions) page here on github. +- There is [Postman](https://documenter.getpostman.com/view/12888943/2s8ZDSdRHA) documentation here for examples on how to run some of the API routes locally - after starting the elasticsearch backend via the docker-compose.yml file. +- The `/examples` folder shows an example of running stac-fastapi-elasticsearch from PyPI in docker without needing any code from the repository. There is also a Postman collection here that you can load into Postman for testing the API routes. ### To install from PyPI: From 50c3d26b3e13d85e7dc87b79c05baa767c99b16a Mon Sep 17 00:00:00 2001 From: jonhealy1 Date: Thu, 28 Mar 2024 20:09:54 +0800 Subject: [PATCH 2/9] update data loader to accept base_url --- README.md | 7 +++ data_loader/data_loader.py | 74 +++++++++++--------------- data_loader/setup_data/collection.json | 2 +- 3 files changed, 40 insertions(+), 43 deletions(-) diff --git a/README.md b/README.md index 7f5f8ea6..c89d70e5 100644 --- a/README.md +++ b/README.md @@ -93,6 +93,13 @@ get the next page of results. curl -X "GET" "http://localhost:8080/collections?limit=1&token=example_token" ``` +## Ingesting Sample Data + +```shell +cd data_loader +python3 data_loader.py --base-url http://localhost:8080 +``` + ## Testing ```shell diff --git a/data_loader/data_loader.py b/data_loader/data_loader.py index 315068b6..a5092157 100644 --- a/data_loader/data_loader.py +++ b/data_loader/data_loader.py @@ -1,69 +1,59 @@ """Database ingestion script.""" import json import os -import sys - import click import requests -if len(sys.argv) != 2: - print("Usage: python data_loader.py ") - sys.exit(1) - +# Define the directory where your data files are located DATA_DIR = os.path.join(os.path.dirname(__file__), "setup_data/") -backend = sys.argv[1].lower() - -if backend == "opensearch": - STAC_API_BASE_URL = "http://localhost:8082" -elif backend == "elasticsearch": - STAC_API_BASE_URL = "http://localhost:8080" -else: - print("Invalid backend tag. Enter either 'opensearch' or 'elasticsearch'.") - - def load_data(filename): - """Load json data.""" + """Load json data from a file.""" with open(os.path.join(DATA_DIR, filename)) as file: return json.load(file) - -def load_collection(collection_id): - """Load stac collection into the database.""" +def load_collection(base_url, collection_id): + """Load a STAC collection into the database.""" collection = load_data("collection.json") collection["id"] = collection_id try: - resp = requests.post(f"{STAC_API_BASE_URL}/collections", json=collection) + resp = requests.post(f"{base_url}/collections", json=collection) if resp.status_code == 200: - print(f"Status code: {resp.status_code}") - print(f"Added collection: {collection['id']}") + click.echo(f"Status code: {resp.status_code}") + click.echo(f"Added collection: {collection['id']}") elif resp.status_code == 409: - print(f"Status code: {resp.status_code}") - print(f"Collection: {collection['id']} already exists") + click.echo(f"Status code: {resp.status_code}") + click.echo(f"Collection: {collection['id']} already exists") except requests.ConnectionError: - click.secho("failed to connect") - + click.secho("Failed to connect", fg="red") -def load_items(): - """Load stac items into the database.""" +def load_items(base_url, collection_id): + """Load STAC items into the database.""" feature_collection = load_data("sentinel-s2-l2a-cogs_0_100.json") - collection = "test-collection" - load_collection(collection) + collection = collection_id + load_collection(base_url, collection) for feature in feature_collection["features"]: try: feature["collection"] = collection - resp = requests.post( - f"{STAC_API_BASE_URL}/collections/{collection}/items", json=feature - ) + resp = requests.post(f"{base_url}/collections/{collection}/items", json=feature) if resp.status_code == 200: - print(f"Status code: {resp.status_code}") - print(f"Added item: {feature['id']}") + click.echo(f"Status code: {resp.status_code}") + click.echo(f"Added item: {feature['id']}") elif resp.status_code == 409: - print(f"Status code: {resp.status_code}") - print(f"Item: {feature['id']} already exists") + click.echo(f"Status code: {resp.status_code}") + click.echo(f"Item: {feature['id']} already exists") except requests.ConnectionError: - click.secho("failed to connect") - - -load_items() + click.secho("Failed to connect", fg="red") + +@click.command() +@click.option('--base-url', required=True, help='Base URL of the STAC API') +@click.option('--collection-id', default='test-collection', help='ID of the collection to which items are added') +def main(base_url, collection_id): + """ + Load STAC items into the database. + """ + load_items(base_url, collection_id) + +if __name__ == '__main__': + main() diff --git a/data_loader/setup_data/collection.json b/data_loader/setup_data/collection.json index f4b2acdf..dd68234d 100644 --- a/data_loader/setup_data/collection.json +++ b/data_loader/setup_data/collection.json @@ -1,5 +1,5 @@ { - "id":"sentinel-s2-l2a-cogs", + "id":"sentinel-s2-l2a-cogs-test", "stac_version":"1.0.0", "description":"Sentinel-2a and Sentinel-2b imagery, processed to Level 2A (Surface Reflectance) and converted to Cloud-Optimized GeoTIFFs", "links":[ From 9f90a34309ff19c869cab38cfd519628f9983ef8 Mon Sep 17 00:00:00 2001 From: jonhealy1 Date: Thu, 28 Mar 2024 22:48:50 +0800 Subject: [PATCH 3/9] fix docstring --- data_loader/data_loader.py | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/data_loader/data_loader.py b/data_loader/data_loader.py index a5092157..91909c7c 100644 --- a/data_loader/data_loader.py +++ b/data_loader/data_loader.py @@ -1,17 +1,20 @@ """Database ingestion script.""" import json import os + import click import requests # Define the directory where your data files are located DATA_DIR = os.path.join(os.path.dirname(__file__), "setup_data/") + def load_data(filename): """Load json data from a file.""" with open(os.path.join(DATA_DIR, filename)) as file: return json.load(file) + def load_collection(base_url, collection_id): """Load a STAC collection into the database.""" collection = load_data("collection.json") @@ -27,6 +30,7 @@ def load_collection(base_url, collection_id): except requests.ConnectionError: click.secho("Failed to connect", fg="red") + def load_items(base_url, collection_id): """Load STAC items into the database.""" feature_collection = load_data("sentinel-s2-l2a-cogs_0_100.json") @@ -36,7 +40,9 @@ def load_items(base_url, collection_id): for feature in feature_collection["features"]: try: feature["collection"] = collection - resp = requests.post(f"{base_url}/collections/{collection}/items", json=feature) + resp = requests.post( + f"{base_url}/collections/{collection}/items", json=feature + ) if resp.status_code == 200: click.echo(f"Status code: {resp.status_code}") click.echo(f"Added item: {feature['id']}") @@ -46,14 +52,18 @@ def load_items(base_url, collection_id): except requests.ConnectionError: click.secho("Failed to connect", fg="red") + @click.command() -@click.option('--base-url', required=True, help='Base URL of the STAC API') -@click.option('--collection-id', default='test-collection', help='ID of the collection to which items are added') +@click.option("--base-url", required=True, help="Base URL of the STAC API") +@click.option( + "--collection-id", + default="test-collection", + help="ID of the collection to which items are added", +) def main(base_url, collection_id): - """ - Load STAC items into the database. - """ + """Load STAC items into the database.""" load_items(base_url, collection_id) -if __name__ == '__main__': + +if __name__ == "__main__": main() From 491496bab5da26a9e8882c016ad276714d9746df Mon Sep 17 00:00:00 2001 From: jonhealy1 Date: Thu, 28 Mar 2024 22:52:08 +0800 Subject: [PATCH 4/9] remove make ingest --- Makefile | 4 ---- README.md | 6 ------ 2 files changed, 10 deletions(-) diff --git a/Makefile b/Makefile index 4dfb2aec..3025a3e4 100644 --- a/Makefile +++ b/Makefile @@ -104,7 +104,3 @@ install-es: pybase-install .PHONY: install-os install-os: pybase-install pip install -e ./stac_fastapi/opensearch[dev,server] - -.PHONY: ingest -ingest: - python3 data_loader/data_loader.py diff --git a/README.md b/README.md index c89d70e5..dfdb0c76 100644 --- a/README.md +++ b/README.md @@ -117,12 +117,6 @@ Test against Elasticsearch only make test-elasticsearch ``` -## Ingest sample data - -```shell -make ingest -``` - ## Elasticsearch Mappings Mappings apply to search index, not source. The mappings are stored in index templates on application startup. From 8b4720a8c2745d3a981d06ab7f50a8f80292076a Mon Sep 17 00:00:00 2001 From: jonhealy1 Date: Thu, 28 Mar 2024 23:39:00 +0800 Subject: [PATCH 5/9] add bulk insert option --- README.md | 14 +++++++++++- data_loader/data_loader.py | 46 ++++++++++++++++++++++++++++++-------- 2 files changed, 50 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index dfdb0c76..05b70bd9 100644 --- a/README.md +++ b/README.md @@ -93,7 +93,19 @@ get the next page of results. curl -X "GET" "http://localhost:8080/collections?limit=1&token=example_token" ``` -## Ingesting Sample Data +## Ingesting Sample Data CLI Tool + +```shell +Usage: data_loader.py [OPTIONS] + + Load STAC items into the database. + +Options: + --base-url TEXT Base URL of the STAC API [required] + --collection-id TEXT ID of the collection to which items are added + --use-bulk Use bulk insert method for items + --help Show this message and exit. +``` ```shell cd data_loader diff --git a/data_loader/data_loader.py b/data_loader/data_loader.py index 91909c7c..7995921c 100644 --- a/data_loader/data_loader.py +++ b/data_loader/data_loader.py @@ -1,4 +1,4 @@ -"""Database ingestion script.""" +"""Data Loader CLI tool.""" import json import os @@ -31,17 +31,23 @@ def load_collection(base_url, collection_id): click.secho("Failed to connect", fg="red") -def load_items(base_url, collection_id): - """Load STAC items into the database.""" +def load_items(base_url, collection_id, use_bulk): + """Load STAC items into the database based on the method selected.""" feature_collection = load_data("sentinel-s2-l2a-cogs_0_100.json") - collection = collection_id - load_collection(base_url, collection) + load_collection(base_url, collection_id) + if use_bulk: + load_items_bulk_insert(base_url, collection_id, feature_collection) + else: + load_items_one_by_one(base_url, collection_id, feature_collection) + +def load_items_one_by_one(base_url, collection_id, feature_collection): + """Load STAC items into the database one by one.""" for feature in feature_collection["features"]: try: - feature["collection"] = collection + feature["collection"] = collection_id resp = requests.post( - f"{base_url}/collections/{collection}/items", json=feature + f"{base_url}/collections/{collection_id}/items", json=feature ) if resp.status_code == 200: click.echo(f"Status code: {resp.status_code}") @@ -53,6 +59,27 @@ def load_items(base_url, collection_id): click.secho("Failed to connect", fg="red") +def load_items_bulk_insert(base_url, collection_id, feature_collection): + """Load STAC items into the database via bulk insert.""" + try: + for i, _ in enumerate(feature_collection["features"]): + feature_collection["features"][i]["collection"] = collection_id + resp = requests.post( + f"{base_url}/collections/{collection_id}/items", json=feature_collection + ) # Adjust this endpoint as necessary + if resp.status_code == 200: + click.echo(f"Status code: {resp.status_code}") + click.echo("Bulk inserted items successfully.") + elif resp.status_code == 204: + click.echo(f"Status code: {resp.status_code}") + click.echo("Bulk update successful, no content returned.") + elif resp.status_code == 409: + click.echo(f"Status code: {resp.status_code}") + click.echo("Conflict detected, some items might already exist.") + except requests.ConnectionError: + click.secho("Failed to connect", fg="red") + + @click.command() @click.option("--base-url", required=True, help="Base URL of the STAC API") @click.option( @@ -60,9 +87,10 @@ def load_items(base_url, collection_id): default="test-collection", help="ID of the collection to which items are added", ) -def main(base_url, collection_id): +@click.option("--use-bulk", is_flag=True, help="Use bulk insert method for items") +def main(base_url, collection_id, use_bulk): """Load STAC items into the database.""" - load_items(base_url, collection_id) + load_items(base_url, collection_id, use_bulk) if __name__ == "__main__": From c599955703bcf16d1dc96ab460d817ce8ea97d66 Mon Sep 17 00:00:00 2001 From: jonhealy1 Date: Fri, 29 Mar 2024 00:01:12 +0800 Subject: [PATCH 6/9] add data directory option, move data loader tool --- README.md | 3 +- data_loader/data_loader.py => data_loader.py | 74 +++++++++---------- .../collection.json | 0 .../sentinel-s2-l2a-cogs_0_100.json | 0 4 files changed, 35 insertions(+), 42 deletions(-) rename data_loader/data_loader.py => data_loader.py (56%) rename {data_loader/setup_data => sample_data}/collection.json (100%) rename {data_loader/setup_data => sample_data}/sentinel-s2-l2a-cogs_0_100.json (100%) diff --git a/README.md b/README.md index 05b70bd9..0fe027fd 100644 --- a/README.md +++ b/README.md @@ -104,11 +104,12 @@ Options: --base-url TEXT Base URL of the STAC API [required] --collection-id TEXT ID of the collection to which items are added --use-bulk Use bulk insert method for items + --data-dir PATH Directory containing collection.json and feature + collection file --help Show this message and exit. ``` ```shell -cd data_loader python3 data_loader.py --base-url http://localhost:8080 ``` diff --git a/data_loader/data_loader.py b/data_loader.py similarity index 56% rename from data_loader/data_loader.py rename to data_loader.py index 7995921c..e14a1aee 100644 --- a/data_loader/data_loader.py +++ b/data_loader.py @@ -1,23 +1,20 @@ -"""Data Loader CLI tool.""" import json import os - import click import requests -# Define the directory where your data files are located -DATA_DIR = os.path.join(os.path.dirname(__file__), "setup_data/") - - -def load_data(filename): - """Load json data from a file.""" - with open(os.path.join(DATA_DIR, filename)) as file: +def load_data(data_dir, filename): + """Load json data from a file within the specified data directory.""" + filepath = os.path.join(data_dir, filename) + if not os.path.exists(filepath): + click.secho(f"File not found: {filepath}", fg="red", err=True) + raise click.Abort() + with open(filepath) as file: return json.load(file) - -def load_collection(base_url, collection_id): +def load_collection(base_url, collection_id, data_dir): """Load a STAC collection into the database.""" - collection = load_data("collection.json") + collection = load_data(data_dir, "collection.json") collection["id"] = collection_id try: resp = requests.post(f"{base_url}/collections", json=collection) @@ -28,27 +25,30 @@ def load_collection(base_url, collection_id): click.echo(f"Status code: {resp.status_code}") click.echo(f"Collection: {collection['id']} already exists") except requests.ConnectionError: - click.secho("Failed to connect", fg="red") - + click.secho("Failed to connect", fg="red", err=True) -def load_items(base_url, collection_id, use_bulk): +def load_items(base_url, collection_id, use_bulk, data_dir): """Load STAC items into the database based on the method selected.""" - feature_collection = load_data("sentinel-s2-l2a-cogs_0_100.json") - load_collection(base_url, collection_id) + # Attempt to dynamically find a suitable feature collection file + feature_files = [file for file in os.listdir(data_dir) if file.endswith('.json') and file != "collection.json"] + if not feature_files: + click.secho("No feature collection files found in the specified directory.", fg="red", err=True) + raise click.Abort() + feature_collection_file = feature_files[0] # Use the first found feature collection file + feature_collection = load_data(data_dir, feature_collection_file) + + load_collection(base_url, collection_id, data_dir) if use_bulk: - load_items_bulk_insert(base_url, collection_id, feature_collection) + load_items_bulk_insert(base_url, collection_id, feature_collection, data_dir) else: - load_items_one_by_one(base_url, collection_id, feature_collection) + load_items_one_by_one(base_url, collection_id, feature_collection, data_dir) - -def load_items_one_by_one(base_url, collection_id, feature_collection): +def load_items_one_by_one(base_url, collection_id, feature_collection, data_dir): """Load STAC items into the database one by one.""" for feature in feature_collection["features"]: try: feature["collection"] = collection_id - resp = requests.post( - f"{base_url}/collections/{collection_id}/items", json=feature - ) + resp = requests.post(f"{base_url}/collections/{collection_id}/items", json=feature) if resp.status_code == 200: click.echo(f"Status code: {resp.status_code}") click.echo(f"Added item: {feature['id']}") @@ -56,17 +56,14 @@ def load_items_one_by_one(base_url, collection_id, feature_collection): click.echo(f"Status code: {resp.status_code}") click.echo(f"Item: {feature['id']} already exists") except requests.ConnectionError: - click.secho("Failed to connect", fg="red") - + click.secho("Failed to connect", fg="red", err=True) -def load_items_bulk_insert(base_url, collection_id, feature_collection): +def load_items_bulk_insert(base_url, collection_id, feature_collection, data_dir): """Load STAC items into the database via bulk insert.""" try: for i, _ in enumerate(feature_collection["features"]): feature_collection["features"][i]["collection"] = collection_id - resp = requests.post( - f"{base_url}/collections/{collection_id}/items", json=feature_collection - ) # Adjust this endpoint as necessary + resp = requests.post(f"{base_url}/collections/{collection_id}/items", json=feature_collection) # Adjust this endpoint as necessary if resp.status_code == 200: click.echo(f"Status code: {resp.status_code}") click.echo("Bulk inserted items successfully.") @@ -77,21 +74,16 @@ def load_items_bulk_insert(base_url, collection_id, feature_collection): click.echo(f"Status code: {resp.status_code}") click.echo("Conflict detected, some items might already exist.") except requests.ConnectionError: - click.secho("Failed to connect", fg="red") - + click.secho("Failed to connect", fg="red", err=True) @click.command() @click.option("--base-url", required=True, help="Base URL of the STAC API") -@click.option( - "--collection-id", - default="test-collection", - help="ID of the collection to which items are added", -) +@click.option("--collection-id", default="test-collection", help="ID of the collection to which items are added") @click.option("--use-bulk", is_flag=True, help="Use bulk insert method for items") -def main(base_url, collection_id, use_bulk): +@click.option("--data-dir", type=click.Path(exists=True), default="sample_data/", help="Directory containing collection.json and feature collection file") +def main(base_url, collection_id, use_bulk, data_dir): """Load STAC items into the database.""" - load_items(base_url, collection_id, use_bulk) - + load_items(base_url, collection_id, use_bulk, data_dir) if __name__ == "__main__": - main() + main() \ No newline at end of file diff --git a/data_loader/setup_data/collection.json b/sample_data/collection.json similarity index 100% rename from data_loader/setup_data/collection.json rename to sample_data/collection.json diff --git a/data_loader/setup_data/sentinel-s2-l2a-cogs_0_100.json b/sample_data/sentinel-s2-l2a-cogs_0_100.json similarity index 100% rename from data_loader/setup_data/sentinel-s2-l2a-cogs_0_100.json rename to sample_data/sentinel-s2-l2a-cogs_0_100.json From 09257ca288292ea0decb78a02e6865bb1e2bdd17 Mon Sep 17 00:00:00 2001 From: jonhealy1 Date: Fri, 29 Mar 2024 00:06:40 +0800 Subject: [PATCH 7/9] add docstring --- data_loader.py | 48 ++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 40 insertions(+), 8 deletions(-) diff --git a/data_loader.py b/data_loader.py index e14a1aee..4bea1d5a 100644 --- a/data_loader.py +++ b/data_loader.py @@ -1,8 +1,11 @@ +"""Data Loader CLI STAC_API Ingestion Tool.""" import json import os + import click import requests + def load_data(data_dir, filename): """Load json data from a file within the specified data directory.""" filepath = os.path.join(data_dir, filename) @@ -12,6 +15,7 @@ def load_data(data_dir, filename): with open(filepath) as file: return json.load(file) + def load_collection(base_url, collection_id, data_dir): """Load a STAC collection into the database.""" collection = load_data(data_dir, "collection.json") @@ -27,14 +31,25 @@ def load_collection(base_url, collection_id, data_dir): except requests.ConnectionError: click.secho("Failed to connect", fg="red", err=True) + def load_items(base_url, collection_id, use_bulk, data_dir): """Load STAC items into the database based on the method selected.""" # Attempt to dynamically find a suitable feature collection file - feature_files = [file for file in os.listdir(data_dir) if file.endswith('.json') and file != "collection.json"] + feature_files = [ + file + for file in os.listdir(data_dir) + if file.endswith(".json") and file != "collection.json" + ] if not feature_files: - click.secho("No feature collection files found in the specified directory.", fg="red", err=True) + click.secho( + "No feature collection files found in the specified directory.", + fg="red", + err=True, + ) raise click.Abort() - feature_collection_file = feature_files[0] # Use the first found feature collection file + feature_collection_file = feature_files[ + 0 + ] # Use the first found feature collection file feature_collection = load_data(data_dir, feature_collection_file) load_collection(base_url, collection_id, data_dir) @@ -43,12 +58,15 @@ def load_items(base_url, collection_id, use_bulk, data_dir): else: load_items_one_by_one(base_url, collection_id, feature_collection, data_dir) + def load_items_one_by_one(base_url, collection_id, feature_collection, data_dir): """Load STAC items into the database one by one.""" for feature in feature_collection["features"]: try: feature["collection"] = collection_id - resp = requests.post(f"{base_url}/collections/{collection_id}/items", json=feature) + resp = requests.post( + f"{base_url}/collections/{collection_id}/items", json=feature + ) if resp.status_code == 200: click.echo(f"Status code: {resp.status_code}") click.echo(f"Added item: {feature['id']}") @@ -58,12 +76,15 @@ def load_items_one_by_one(base_url, collection_id, feature_collection, data_dir) except requests.ConnectionError: click.secho("Failed to connect", fg="red", err=True) + def load_items_bulk_insert(base_url, collection_id, feature_collection, data_dir): """Load STAC items into the database via bulk insert.""" try: for i, _ in enumerate(feature_collection["features"]): feature_collection["features"][i]["collection"] = collection_id - resp = requests.post(f"{base_url}/collections/{collection_id}/items", json=feature_collection) # Adjust this endpoint as necessary + resp = requests.post( + f"{base_url}/collections/{collection_id}/items", json=feature_collection + ) # Adjust this endpoint as necessary if resp.status_code == 200: click.echo(f"Status code: {resp.status_code}") click.echo("Bulk inserted items successfully.") @@ -76,14 +97,25 @@ def load_items_bulk_insert(base_url, collection_id, feature_collection, data_dir except requests.ConnectionError: click.secho("Failed to connect", fg="red", err=True) + @click.command() @click.option("--base-url", required=True, help="Base URL of the STAC API") -@click.option("--collection-id", default="test-collection", help="ID of the collection to which items are added") +@click.option( + "--collection-id", + default="test-collection", + help="ID of the collection to which items are added", +) @click.option("--use-bulk", is_flag=True, help="Use bulk insert method for items") -@click.option("--data-dir", type=click.Path(exists=True), default="sample_data/", help="Directory containing collection.json and feature collection file") +@click.option( + "--data-dir", + type=click.Path(exists=True), + default="sample_data/", + help="Directory containing collection.json and feature collection file", +) def main(base_url, collection_id, use_bulk, data_dir): """Load STAC items into the database.""" load_items(base_url, collection_id, use_bulk, data_dir) + if __name__ == "__main__": - main() \ No newline at end of file + main() From 516dcb3cf20fa9bbe5eeddff52f53cb5df6fc760 Mon Sep 17 00:00:00 2001 From: jonhealy1 Date: Fri, 29 Mar 2024 00:11:51 +0800 Subject: [PATCH 8/9] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 73c29c2f..f768d50f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Changed - Updated the pip_docker example to use stac-fastapi.elasticsearch 2.1.0 and the elasticsearch 8.11.0 docker image. [#216](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/216) +- Updated the Data Loader CLI tool to accept a base_url, a data directory, a custom collection id, and an option to use bulk insert. [#218](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/218) ### Fixed From 47b77e5a6fed508743b85a783556b534adbbcf26 Mon Sep 17 00:00:00 2001 From: jonhealy1 Date: Fri, 29 Mar 2024 00:17:57 +0800 Subject: [PATCH 9/9] clean comments --- data_loader.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data_loader.py b/data_loader.py index 4bea1d5a..1cccffd5 100644 --- a/data_loader.py +++ b/data_loader.py @@ -84,7 +84,7 @@ def load_items_bulk_insert(base_url, collection_id, feature_collection, data_dir feature_collection["features"][i]["collection"] = collection_id resp = requests.post( f"{base_url}/collections/{collection_id}/items", json=feature_collection - ) # Adjust this endpoint as necessary + ) if resp.status_code == 200: click.echo(f"Status code: {resp.status_code}") click.echo("Bulk inserted items successfully.")