New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

elasticsearch-helper

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

elasticsearch-helper - npm Package Compare versions

Comparing version 1.8.0 to 1.9.0

45

class/search-type.js

@@ -13,5 +13,5 @@ 'use strict'

SearchType.prototype = {
_setValues : function(p_sType,p_sKey,p_sValue){
_setValues : function(p_sType,p_sKey,p_uValue){
this.sKey = p_sKey;
this.uValue = p_sValue;
this.uValue = p_uValue;
this.sType = p_sType;

@@ -54,12 +54,37 @@ },

},
geo: function(p_sKey,p_oPoint,p_sDistance,p_sDistanceType){
if(p_sDistanceType && (p_sDistanceType !== "arc" || p_sDistanceType !== "plane"))
throw "Distance type needs to be 'arc' or 'plane'";
this._setValues("geo_distance",p_sKey,{
distance: p_sDistance,
type: p_sDistanceType,
point: p_oPoint
})
return this;
},
render: function(){
var oObj = {}
if(this.sType == "nested"){
oObj[this.sType] = {
path : this.sKey,
query: this.uValue.render()
};
}else{
oObj[this.sType] = {};
oObj[this.sType][this.sKey] = this.uValue;
switch(this.sType){
case "geo_distance":
oObj[this.sType] = {
"distance" : this.uValue.distance,
[this.sKey] : this.uValue.point
}
if(this.uValue.type){
oObj[this.sType].distance_type = this.uValue.type
}
break;
case "nested":
oObj[this.sType] = {
path : this.sKey,
query: this.uValue.render()
};
break;
default:
oObj[this.sType] = {};
oObj[this.sType][this.sKey] = this.uValue;
break;
}

@@ -66,0 +91,0 @@

@@ -572,2 +572,6 @@ 'use strict';

return oST.nested.apply(oST, arguments);
},
geo : function(){
var oST = new SearchType();
return oST.geo.apply(oST, arguments);
}

@@ -574,0 +578,0 @@ },

{
"name": "elasticsearch-helper",
"version": "1.8.0",
"version": "1.9.0",
"description": "A Nodejs module facilitating querying Elasticsearch clusters.",

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

@@ -378,3 +378,19 @@

* geo distance
Geo distance is an advanced feature that require a specific mapping in your index. For more information:
https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-geo-distance-query.html
Geo distance requires a few parameters:
- The starting point as a latiturde & longitude
- The distance around this point - https://www.elastic.co/guide/en/elasticsearch/reference/current/common-options.html#distance-units
- The type of calculation to apply - `arc` or `planar` (`arc` default)
```javascript
ES.type.geo("fieldkey","origin latlon","distance"[,"calculation"]);
// ex:
ES.type.geo("location.geo",{ "lat": 48,"lon": 2 },"120km"[,"arc"])
//Note: latlon value can be set as string ('48,2') or as an array ([48,2])
```
#### Retrieve

@@ -381,0 +397,0 @@

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