Skip to content
This repository has been archived by the owner on Oct 5, 2022. It is now read-only.

Commit

Permalink
Merge pull request #49 from nearform/expose-suffix
Browse files Browse the repository at this point in the history
feat: expose a method to create your own generated index name
  • Loading branch information
temsa committed Mar 26, 2019
2 parents b57f6dd + 26dbb74 commit 67bf1df
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,15 @@ const {delete: del} = require('leaistic')
await del('an-index')
```

### Build a new Index name for a given alias (useful to manage some updates on your own)
```javascript
const { newIndexName } = require('leaistic')

newIndexName('an-index')
// 'an-index-1234-12-12t12:34:56.789z'
```


## ElasticSearch Connection

By default, Leaistic will connect to `http://127.0.0.1:9200` or the value provided by `ES_URL` environment variable.
Expand Down
2 changes: 2 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ exports.create = (name, {indexTemplate} = {}) => lib.create(name, {body: indexTe
exports.update = (name, {indexTemplate} = {}) => lib.update(name, {body: indexTemplate})
exports.delete = name => lib.delete(name)

exports.newIndexName = (aliasName) => lib.suffix(aliasName)

// override ES client or get a reference to it
exports.connect = connect

Expand Down

0 comments on commit 67bf1df

Please sign in to comment.