@vigneron vigneron authored on 10 Jun
.husky build: run lint on commited files 2 months ago
config config: update scroll variables 2 months ago
elastic Merge pull request #15 from METADoRe/Elasticscroll 2 months ago
lib feat: adding querystring format (for lodex) 1 month ago
openapi feat: adding querystring format (for lodex) 1 month ago
routes test: write test for Lodex format 1 month ago
.dockerignore build: add ignore files 3 months ago
.eslintignore typo: rename file 2 months ago
.eslintrc.js style: adding eslint jest plugins 3 months ago
.gitignore feat: create api key manager 2 months ago
.npmrc build: adding versions files 3 months ago
.nvmrc build: adding versions files 3 months ago
Dockerfile build: write Dockerfile and docker-compose files 2 months ago
README.md doc: update readme.md 2 months ago
app.js doc: write JSDoc 2 months ago
docker-compose.debug.yml build: write Dockerfile and docker-compose files 2 months ago
docker-compose.yml build: write Dockerfile and docker-compose files 2 months ago
package-lock.json Version 1.0.0 1 month ago
package.json Version 1.0.0 1 month ago
server.js fix: catch apiKeyManager messages 2 months ago




$ git clone https://gitbucket.inist.fr/git/METADoRe/reseda-search.git
$ cd ./reseda-search


$ docker-compose up -d api



A master API key is created at the first launch of the application, API keys are stored in ./api-keys.json file.

An API key gives access to more fields returned by the API, for examples:

  "a7e666ed93d877d9a4f9": {
    "name": "my-api-key",
    "fields": {
      "employees": ["*"],
      "structures": ["field", "field.subfield", "field.*"],
  "939500eae15165ab4b8a": {
    "name": "my-api-key",
    "fields": {
      "employees": ["field"],
  "e24d1167135d65bfcaad": {
    "name": "my-api-key",
    "fields": {
      "structures": ["field.*"],

employees (type: Array) and structures (type: Array) are optional, the fields returned by the API will be the default ones (cf: Environment variables - FIELDS_NAME).

The values of its tables can be:

  • * gives access to all the fields.
  • field gives access to a field
  • field.subfield gives access to a subfield
  • field.* gives access to all subfields

There are two ways to use an api key, by the header x-api-key (in lowercase) or the url parameter apiKey.


$ curl -H "x-api-key: 6596ae25fdfdc83b85a7" http://localhost:3000/employees

$ curl http://localhost:3000/employees?apiKey=6596ae25fdfdc83b85a7


$ npm install # Install Node.JS dependencies
$ docker-compose -f docker-compose.debug.yml run --rm elastic chown -R elasticsearch /usr/share/elasticsearch/ # Chown ElasticSearch volume
$ docker-compose -f docker-compose.debug.yml up -d elastic # Run ElasticSearch
$ docker-compose -f docker-compose.debug.yml up -d api # Run API in development mode


$ npm run test

Environment variables

Name Type Description
APP_PORT Integer Application port (default: 3000)
ELASTICSEARCH_SCHEME String URI scheme (default: https)
ELASTICSEARCH_HOST String ElasticSerach host (default: localhost)
ELASTICSEARCH_PORT Integer ElasticSerach port (default: 9200)
ELASTICSEARCH_USERNAME String ElasticSerach host (default: elastic)
ELASTICSEARCH_PASSWORD String ElasticSerach host (default: changeme)
RESEDA_EMPLOYEES_INDEX String Reseda employees index name (default: employees)
RESEDA_STRUCTURES_INDEX String Reseda structures index name (default: structures)
PARAMS_MAX_SIZE Integer Query max size (default: 1000)
PARAMS_DEFAULT_SIZE Integer Query default size (default: 25)
RESEDA_DOC_URL String OpenAPI URL (default: docs)
FIELDS_NAME JSON Default returned fields (default: { "employees": [ "nomUsage", "prenom", "UUIDPersonne", "affectationAdministrative.codeUnite" ], "structures": [ "codeUnite", "intituleUnite" ] })
SCROLL_TIME String Scroll time (default: 5m)


The OpenAPI page is by default available on /docs, example: http://localhost:3000/docs. You can change the URL via the environment variable RESEDA_DOC_URL.