3.0.0 • Published 4 months ago
functional-models-orm-elastic v3.0.0
Functional Models ORM Elastic
How To Install
npm install functional-models-orm-elastic
How To Use
import { createOrm } from 'functional-models'
import { datastoreAdapter as elasticDatastore } from 'functional-models-orm-elastic'
import { Client } from '@opensearch-project/opensearch'
// Create your client.
const client = new Client({
node: 'http://localhost:9200',
})
// Create datastoreAdapter
const datastoreAdapter = elasticDatastore.create({
client,
})
// Create an orm for use with your models.
const orm = createOrm({ datastoreAdapter })
Notes on Running with AWS OpenSearch
One way to use the client is with a username/password and the elastic url.
Here is an example:
const url = `https://${elasticUsername}:${elasticPassword}@${elasticUrl}`
const client = new Client({
node: url,
})