Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
angular-elastic-builder
Advanced tools
Readme
This is an Angular.js directive for building an Elasticsearch query. You just give it the fields and can generate a query for it. Its layout is defined using Bootstrap classes, but you may also choose to just style it yourself.
It's still pretty early on, as it doesn't support a whole lot of use-cases, but we need to make it awesome. Contributions accepted.
Notice: this plugin requires:
First you'll need to download the dist files and include this JS file to your app (don't forget to substitute x.x.x
with the current version number), along with the RecursionHelper, if you're not already using it.
<script type="text/javascript" src="angular-ui-bootstrap/ui-bootstrap-tpls.js"></script>
<script type="text/javascript" src="angular-recursion/angular-recursion.min.js"></script>
<script type="text/javascript" src="angular-elastic-builder/angular-elastic-builder.min.js"></script>
Then make sure that it's included in your app's dependencies during module creation.
angularmodule('appName', [ 'angular-elastic-builder' ]);
Then you can use it in your app
/* Controller code */
/**
* The elasticBuilderData object will be modified in place so that you can use
* your own $watch, and/or your own saving mechanism
*/
$scope.elasticBuilderData = {};
$scope.elasticBuilderData.query = [];
/**
* This object is the lookup for what fields
* are available in your database, as well as definitions of what kind
* of data they are
*/
$scope.elasticBuilderData.fields = {
'test.number': { type: 'number', minimum: 650 },
'test.term': { type: 'term' },
'test.boolean': { type: 'term', subType: 'boolean' },
'test.state.multi': { type: 'multi', choices: [ 'AZ', 'CA', 'CT' ]},
'test.date': { type: 'date' },
'test.otherdate': { type: 'date' }
};
<div data-elastic-builder="elasticBuilderData"></div>
The above elasticFields would allow you create the following form:
Which represents the following Elasticsearch Query:
[
{
"and": [
{
"term": {
"test.date": "2016-04-08T10:44:06"
}
},
{
"range": {
"test.number": {
"gte": 650
}
}
},
{
"range": {
"test.number": {
"lt": 850
}
}
}
]
},
{
"term": {
"test.boolean": 0
}
},
{
"terms": {
"test.state.multi": [ "AZ", "CT" ]
}
},
{
"not": {
"filter": {
"term": {
"test.term": "asdfasdf"
}
}
}
},
{
"exists": {
"field": "test.term"
}
},
{
"range": {
"test.otherdate": {
"gte": "now",
"lte": "now+7d"
}
}
}
]
type
: This determines how the fields are displayed in the form.
'number'
: in addition to Generic Options, gets ">", "≥", "<", "≤", "="'term'
: in addition to Generic Options, gets "Equals" and "! Equals"'boolean'
: Does not get Generic Options. Gets true
and false
'date'
: in addition to Generic Options, gets ">", "≥", "<", "≤", "="Generic Options
If you want to pass in an initial state (or if you make changes to the query externally), you'll need to
set the configuration flag needsUpdate
to true
. Any time this flag changes to true
, this directive
will overwrite the current state and data with whatever is now defined in your configuration object.
To work on this module locally, you will need to clone it and run gulp watch
. This will ensure that your changes get compiled properly. You will also need to make sure you run gulp
to build the "dist" files before commit.
FAQs
Angular Module for building an Elasticsearch Query
The npm package angular-elastic-builder receives a total of 19 weekly downloads. As such, angular-elastic-builder popularity was classified as not popular.
We found that angular-elastic-builder demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.