8.15.1 • Published 8 months ago
@dedel.alex/adonis5-elasticsearch v8.15.1
Install Elasticsearch Provider in Adonis
Install dependency
npm i @dedel.alex/adonis5-elasticsearch
Run command
node ace configure @dedel.alex/adonis5-elasticsearch
Configure Elasticsearch
# Elasticsearch HOST
ELASTICSEARCH_URI=https://127.0.0.1:9200
# Elasticsearch user
ELASTICSEARCH_USER="elastic"
# Elasticsearch password
ELASTICSEARCH_PASSWORD=""
# Elasticsearch options
ELASTICSEARCH_OPTIONS=""
Usage
Here is an example of how to use the Elasticsearch Provider:
import client from "@ioc:Adonis/Addons/Elasticsearch";
// Get index - where the documents are stored.
const index = await client.index({
index: "game-of-thrones",
document: {
character: "Ned Stark",
quote: "Winter is coming.",
},
});
// here we are forcing an index refresh, otherwise we will not
// get any result in the consequent search
await client.indices.refresh({ index: "game-of-thrones" });
// Let's search!
const result = await client.search({
index: "game-of-thrones",
query: {
match: { quote: "winter" },
},
});
console.log(result.hits.hits);
For more information about Elasticsearch, check the offical website
Github project
8.15.1
8 months ago
8.14.0
12 months ago
8.15.0
10 months ago
8.14.1
10 months ago
8.13.1
1 year ago
8.12.3
1 year ago
8.13.0
1 year ago
8.12.2
1 year ago
8.12.1
1 year ago
8.12.0
1 year ago
8.10.0
1 year ago
8.11.0
1 year ago
1.0.7
2 years ago
1.0.2
2 years ago
1.0.6
2 years ago
1.0.5
2 years ago
1.0.4
2 years ago
1.0.3
2 years ago
1.0.1
2 years ago
1.0.0
2 years ago