Skip to content
This repository has been archived by the owner on Sep 19, 2023. It is now read-only.

Latest commit

 

History

History
30 lines (22 loc) · 624 Bytes

instructions.md

File metadata and controls

30 lines (22 loc) · 624 Bytes

Set the environment variable

Make sure you set the ES_URL environment variable in your .env file. This will be used to access your Elasticsearch server.

ES_URL=http://localhost:9200

Registering the provider

Make sure to register the provider inside start/app.js file.

const providers = ["@lecoupa/adonis-elasticsearch/providers/ElasticProvider"];

That's all! Now you can use the provider by pulling it from IoC container

const Elastic = use("Elastic");

const response = await Elastic.search({
  index: "my-index",
  body: {
    query: {
      match_all: {},
    },
  },
});