Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

es-alchemy

Package Overview
Dependencies
Maintainers
1
Versions
318
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

es-alchemy - npm Package Compare versions

Comparing version 8.4.2 to 8.5.0

15

lib/util/rest/data/uniques.js

@@ -16,7 +16,8 @@ "use strict";

module.exports = (call, idx, allowedFields, field, opts) => {
module.exports = (call, idx, allowedFields, fields, opts) => {
Joi.assert(opts, Joi.object().keys({
filterBy: Joi.object().optional(),
limit: Joi.number().integer().min(1).optional(),
cursor: Joi.string().optional()
cursor: Joi.string().optional(),
count: Joi.boolean().optional()
}).nand('limit', 'cursor'));

@@ -26,2 +27,3 @@ const cursorPayload = opts.cursor === undefined ? null : fromCursor(opts.cursor);

const limit = get(cursorPayload, 'limit', get(opts, 'limit', 20));
const count = opts.count === undefined ? false : opts.count;
const body = {

@@ -35,3 +37,3 @@ size: 0,

size: limit,
sources: [{
sources: (Array.isArray(fields) ? fields : [fields]).map(field => ({
[field]: {

@@ -42,3 +44,3 @@ terms: {

}
}]
}))
}

@@ -65,3 +67,6 @@ }

const result = {
uniques: uniques.buckets.map(e => e.key[field])
uniques: uniques.buckets.map(e => {
const value = Array.isArray(fields) ? fields.map(field => e.key[field]) : e.key[fields];
return count ? [value, e.doc_count] : value;
})
};

@@ -68,0 +73,0 @@

{
"name": "es-alchemy",
"version": "8.4.2",
"version": "8.5.0",
"description": "Simplification of Elasticsearch interactions",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -412,3 +412,3 @@ # ESAlchemy

- `data.synced(index: String)` - returns true if all local index version exists on remote and have the same document count
- `data.uniques(index: String, field: String, opts = { filterBy = {}, limit = 20, cursor = null })` - get unique values from index for field, using filter
- `data.uniques(index: String, fields: String[] || String, opts = { filterBy = {}, limit = 20, cursor = null, count = boolean })` - get unique values from index for field, using filter. When count true, the counts per unique are returned
- `data.update(options: Object)` - update or delete documents in Elasticsearch (all index versions)

@@ -415,0 +415,0 @@ - `data.version(index: String, id: String)` - get version number in alias for document or null if document does not exist

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc