GitXplorerGitXplorer
r

webhook-elastic-search

public
0 stars
0 forks
0 issues

Commits

List of commits on branch master.
Unverified
66d4d326f61a5b2d8df538b08354bd49dc93a14c

Merge branch 'hotfix/4.0.3'

rrubillionaire committed a month ago
Unverified
dafb713a01c743af16c59beb28de82c9f69c6f18

4.0.3

rrubillionaire committed a month ago
Unverified
4d5c5e8776f1a8cfacfee26cdb4636a8efc1d80e

Merge branch 'hotfix/4.0.2'

rrubillionaire committed a month ago
Unverified
3baa9757f0c51b42e1031bbe2263c1d7de23dc03

[Makefile] update to use Elasticsearch 18.5.2, due to a failure mode found in 18.5.1, which we were previsouly using. all tests are passing, so the elastic cloud update is in motion

rrubillionaire committed a month ago
Unverified
2594ec23eca3626e90d17e3e5cd88c43987acbac

Merge branch 'release/4.0.1'

rrubillionaire committed 4 months ago
Unverified
cb98479495622e823251356f60b9064c43f941d2

4.0.1

rrubillionaire committed 4 months ago

README

The README file for this repository.

webhook-elastic-search

Interface for interacting with the Elastic Search that backs a Webhook system.

To install: npm install webhook-elastic-search

Example:

var elasticOptions = {
  node: elasticNode,
  auth: {
    apiKey: elasticApiKey,
  },
}

var elastic = WebHookElasticSearch(elasticOptions)

elastic.siteIndex(siteName)
  .then(siteIndex => console.log(siteIndex))

API

siteIndex(siteName) => Promise[siteIndex | error] returns all documents in Elastic Search for the site. Where siteName is the Webhook site name. The promise returns siteIndex, an array of Elastic Search documents for the Webhook site.

updateIndex({ siteName, siteData, siteIndex }) => Promise[results | error] issues bulk commands that update the siteIndex to be in sync with the siteData. siteData is the current Firebase data node ( /buckets/{site-name}/{site-key}/dev ) for the Webhook site.

indexSiteData({ siteName, siteData }) => Promise[results | error] is a convenience method that runs createIndex, siteIndex & updateIndex for a given site. This will get you from nothing to complete usuable site index in one go.

listIndicies({ verbose?, sort?, index? }) => Promise[indiciesTable | error] returns indicesTable, a string that contains a table of indicies in the elastic cluster.

createIndex({ siteName}) => Promise[results | error] creates an index in the elastic cluster that can be used to store and query documents.

deleteIndex({ siteName }) => Promise[results | error] deletes an entire site index.

queryIndex({ siteName, query, contentType?, page?, pageSize? }) => Promise[results | error] returns the query results that match the query for the site index and optionally the specified content type.

deleteDocument({ siteName, id }) => Promise[results | error] deletes the document whose id matches for the given site.

deleteContentType({ siteName, contentType }) => Promise[results | error] delets all documents for the specified content type and site.

indexDocument({ siteName, contentType, doc, id, oneOff? }) => Promise[results | error] adds a document to the specified site index under the id and content type provided. Use the oneOff key to specify if the given content type is a one off.

Test

Populate a .env file with the following environment variables:

ELASTIC_SEARCH_SERVER=
ELASTIC_SEARCH_USER=
ELASTIC_SEARCH_PASSWORD=

Run npm test