For general data loading commands, see [Data Harvesting and Indexing](#Data Harvesting and Indexing).
For loading test data, see Test data below.
Before all, take care to get data locally before running any indexing script.
Start an elasticsearch instance using
docker-compose upThen, to index the data in the specified directory (/path/to/local/data/) into the Elasticsearch instance running on localhost, run the following command:
./scripts/harvest.sh -jsonDir /path/to/local/data/ -es_host localhost -env dev -vSee ./scripts/harvest.sh --help for more information.
The FAIDARE Docker image uses Alpine Linux as the base, which can lead to compatibility issues on certain systems, such as macOS with ARM processors (Apple Silicon). Below are the specific instructions for running the indexing command on Linux, macOS, and Windows:
- Finding the Container for
--networkTo determine the name of the container to use with the--network=container:<container_name>option, run the following command:
docker ps
This will list all running containers. Look for the container name in the NAMES column. For example, if the container name is elasticsearch-faidare, you would use it as follows:
--network=container:elasticsearch-faidare
- Linux Run the command as is:
docker run -t --volume /path/to/local/data:/opt/data/ --network=container:elasticsearch-faidare registry.forgemia.inra.fr/urgi/is/docker-rare/faidare-loader:latest -jsonDir /opt/data/
- MacOS: On Apple Silicon (ARM64), ensure Rosetta is enabled for Docker Desktop and specify the platform explicitly:
docker run --platform linux/amd64 -t --volume /path/to/local/data:/opt/data/ --network=container:elasticsearch-faidare registry.forgemia.inra.fr/urgi/is/docker-rare/faidare-loader:latest -jsonDir /opt/data/
For Intel-based Macs, no additional flags are needed:
docker run -t --volume /path/to/local/data:/opt/data/ --network=container:elasticsearch-faidare registry.forgemia.inra.fr/urgi/is/docker-rare/faidare-loader:latest -jsonDir /opt/data/
- Windows: Adapt the volume path to Windows format (e.g., C:/path/to/local/data):
docker run -t --volume C:/path/to/local/data:/opt/data/ --network=container:elasticsearch-faidare registry.forgemia.inra.fr/urgi/is/docker-rare/faidare-loader:latest -jsonDir /opt/data/
To more help add --help parameter to the command.
If you depend on committed changes in indexing scripts under a specific branch (the docker image should have been automatically created by the CI), you need to change the tag of the docker image according to the branch name (ie. for branch epic/merge-faidare-dd, use tag epic-merge-faidare-dd, see CI_COMMIT_REF_SLUG Gitlab predefined variable), as following:
docker run -t --volume /path/to/local/data:/opt/data/ --network=container:elasticsearch-faidare registry.forgemia.inra.fr/urgi/is/docker-rare/faidare-loader:epic-merge-faidare-dd` -jsonDir /opt/data/ --help[Data Harvesting and Indexing](#Data Harvesting and Indexing) section above expects to have an available docker image on the forgemia docker registry. The Gitlab CI rebuild it when needed, but you can update or push such an image using the following commands:
# build the image
docker build -t registry.forgemia.inra.fr/urgi/is/docker-rare/faidare-loader:latest .
# Login before pushing the image
TOKEN= # your PAT from forgeMIA
echo "$TOKEN" | docker login registry.forgemia.inra.fr/urgi/is/docker-rare -u <your ForgeMIA username> --password-stdin
# push the built image
docker push registry.forgemia.inra.fr/urgi/is/docker-rare/faidare-loader:latestThat should ease the indexing of data without having to craft a dedicated environment.
docker compose up will start an Elasticsearch instance
To load the test data with the necessary indices and mappings, you can use one of the following methods:
- Using the Docker image (recommended for simplicity and consistency).
- Running the script locally on your machine.
For detailed instructions on using the FAIDARE Docker image, refer to the relevant section in the README.md.
docker run -t --volume ./data/test:/opt/data/ --network=container:elasticsearch-faidare registry.forgemia.inra.fr/urgi/is/docker-rare/faidare-loader:latest -jsonDir /opt/data/NB: adapt the docker command depending on your [operating system](### Indexing commands with Docker per Operating System).
NB2: Ensure you have an up to date access token to the container registry. If not, you can generate one from the ForgeMIA website or contact us.
For instance for MacOS ARM on the new-api branch, the command would be:
docker compose updocker run --platform linux/amd64 -t --volume ./data/test:/opt/data/ --network=container:elasticsearch-faidare registry.forgemia.inra.fr/urgi/is/docker-rare/faidare-loader:feat-upgrade-to-new-api -jsonDir /opt/data/If you prefer, you can run the harvest.sh script directly on your machine. However, please ensure the following dependencies are installed:
- jq (v1.6+): https://github.com/stedolan/jq/releases/tag/jq-1.6
- GNU parallel: https://www.gnu.org/software/parallel/
- gzip: http://www.gzip.org/
Instructions by Operating System
- Linux: Run the script as follows:
./scripts/harvest.sh -jsonDir data/test/ -es_host localhost -env dev -v
- macOS: Ensure GNU utilities like readlink are available. If using a macOS-specific environment, you might need to install them using Homebrew:
brew install coreutils gnu-parallel jq gzip
Then run:
./scripts/harvest.sh -jsonDir data/test/ -es_host localhost -env dev -v
-
Windows: You can run the script using a Bash environment like Git Bash, WSL, or Cygwin. Ensure all required dependencies are installed within the environment:
./scripts/harvest.sh -jsonDir data/test/ -es_host localhost -env dev -v
Note for macOS and Windows users: Compatibility issues might arise due to system differences. If you encounter any issues, it is recommended to use the Docker-based method.