Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented ElasticSearchStore - All Actions #1

Open
wants to merge 26 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .env.local.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ELASTICSEARCH_NODE=http://localhost:9200
ELASTICSEARCH_INDEX=vector_index
56 changes: 35 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
![Seneca](http://senecajs.org/files/assets/seneca-logo.png)
> A [Seneca.js][] data storage plugin.

# SenecaOpensearchStore
# SenecaElasticStore
[![npm version][npm-badge]][npm-url]
[![Build](https://github.com/senecajs/SenecaOpensearchStore/actions/workflows/build.yml/badge.svg)](https://github.com/senecajs/seneca-OpensearchStore/actions/workflows/build.yml)
[![Build](https://github.com/senecajs/SenecaElasticStore/actions/workflows/build.yml/badge.svg)](https://github.com/senecajs/seneca-ElasticStore/actions/workflows/build.yml)
[![Dependency Status][david-badge]][david-url]
[![Maintainability](https://api.codeclimate.com/v1/badges/e2cdcc5415161cb378b0/maintainability)](https://codeclimate.com/github/senecajs/SenecaOpensearchStore/maintainability)
[![Maintainability](https://api.codeclimate.com/v1/badges/e2cdcc5415161cb378b0/maintainability)](https://codeclimate.com/github/senecajs/SenecaElasticStore/maintainability)
[![DeepScan grade](https://deepscan.io/api/teams/5016/projects/17225/branches/388415/badge/grade.svg)](https://deepscan.io/dashboard#view=project&tid=5016&pid=17225&bid=388415)
[![Coveralls][BadgeCoveralls]][Coveralls]

Expand Down Expand Up @@ -41,7 +41,7 @@ tutorials to sample apps to help get you up and running quickly.

## Code examples

For code samples, please see the [tests][OpensearchStore-tests] for this plugin.
For code samples, please see the [tests][ElasticStore-tests] for this plugin.

### Seneca compatibility
Supports Seneca versions **2.x** and above
Expand All @@ -54,7 +54,7 @@ All Seneca data store supported functionality is implemented in [seneca-store-te

```sh
npm install seneca
npm install SenecaOpensearchStore
npm install SenecaElasticStore
```

You'll need the [seneca](http://github.com/senecajs/seneca) toolkit to use this module - it's just a plugin.
Expand All @@ -67,7 +67,7 @@ var seneca = require('seneca')()
seneca.use('basic')
.use('entity')

// Since OpensearchStore is a default plugin, it does not need to be
// Since ElasticStore is a default plugin, it does not need to be
// added with .use(). You can just go ahead and use it.
seneca.ready(function () {
var apple = seneca.make$('fruit')
Expand Down Expand Up @@ -118,35 +118,49 @@ This store is an in memory store and as such does not require the need of a nati
The [Senecajs org][] encourages open participation. If you feel you can help in any way, be it with
documentation, examples, extra testing, or new features please get in touch.

## Test
To run tests, simply use npm:
## Test
To run tests locally, make sure you have a '.env.local' file in the format:
```
ELASTICSEARCH_NODE=http://localhost:9200
ELASTICSEARCH_INDEX=vector_index
```

Also, you need Docker installed on your machine. Pull the Elastic Docker image from the hub and run the container. You can do this by running the script:
```sh
./test/setup.sh
```
After that, create the index in your local image:
```sh
npm run create-index
```
And to run the tests, use:
```sh
npm run test
```

```sh
npm run test
```

## License
Copyright (c) 2015-2016, Richard Rodger and other contributors.
Copyright (c) 2010-2014, Richard Rodger.
Licensed under [MIT][].

[MIT]: ./LICENSE
[npm-badge]: https://badge.fury.io/js/SenecaOpensearchStore.svg
[npm-url]: https://badge.fury.io/js/SenecaOpensearchStore
[npm-badge]: https://badge.fury.io/js/SenecaElasticStore.svg
[npm-url]: https://badge.fury.io/js/SenecaElasticStore
[Senecajs org]: https://github.com/senecajs/
[Seneca.js]: https://www.npmjs.com/package/seneca
[@senecajs]: http://twitter.com/senecajs
[senecajs.org]: http://senecajs.org/
[travis-badge]: https://travis-ci.org/senecajs/SenecaOpensearchStore.svg
[travis-url]: https://travis-ci.org/senecajs/SenecaOpensearchStore
[travis-badge]: https://travis-ci.org/senecajs/SenecaElasticStore.svg
[travis-url]: https://travis-ci.org/senecajs/SenecaElasticStore
[gitter-badge]: https://badges.gitter.im/Join%20Chat.svg
[gitter-url]: https://gitter.im/senecajs/seneca
[github issue]: https://github.com/senecajs/SenecaOpensearchStore/issues
[github issue]: https://github.com/senecajs/SenecaElasticStore/issues
[ActiveRecord-style data storage API]:http://senecajs.org/tutorials/understanding-data-entities.html
[david-badge]: https://david-dm.org/senecajs/SenecaOpensearchStore.svg
[david-url]: https://david-dm.org/senecajs/SenecaOpensearchStore
[Coveralls]: https://coveralls.io/github/senecajs/SenecaOpensearchStore?branch=master
[BadgeCoveralls]: https://coveralls.io/repos/github/senecajs/SenecaOpensearchStore/badge.svg?branch=master
[david-badge]: https://david-dm.org/senecajs/SenecaElasticStore.svg
[david-url]: https://david-dm.org/senecajs/SenecaElasticStore
[Coveralls]: https://coveralls.io/github/senecajs/SenecaElasticStore?branch=master
[BadgeCoveralls]: https://coveralls.io/repos/github/senecajs/SenecaElasticStore/badge.svg?branch=master
[seneca-basic-url]: https://github.com/senecajs/seneca-basic
[seneca-entity-url]: https://github.com/senecajs/seneca-entity
[OpensearchStore-tests]: https://github.com/senecajs/SenecaOpensearchStore/tree/master/test
[ElasticStore-tests]: https://github.com/senecajs/SenecaElasticStore/tree/master/test
13 changes: 6 additions & 7 deletions dist/OpensearchStore.d.ts → dist/ElasticSearchStore.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
type Options = {
type ElasticSearchStoreOptions = {
debug: boolean;
map?: any;
index: {
Expand Down Expand Up @@ -26,17 +26,16 @@ type Options = {
size: number;
};
};
aws: any;
opensearch: any;
elasticsearch: {
node: string;
};
};
export type OpensearchStoreOptions = Partial<Options>;
declare function OpensearchStore(this: any, options: Options): {
declare function ElasticSearchStore(this: any, options: ElasticSearchStoreOptions): {
name: string;
tag: any;
exportmap: {
native: () => {
client: any;
};
};
};
export default OpensearchStore;
export default ElasticSearchStore;
244 changes: 244 additions & 0 deletions dist/ElasticSearchStore.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading