Skip to content

Instantly share code, notes, and snippets.

View razorcd's full-sized avatar

Cristian Dugacicu razorcd

View GitHub Profile
@razorcd
razorcd / ES_contracts_for_interval.txt
Last active May 17, 2017 09:26
Contracts based on a range intersection where validTo can be null
{
"size": 9999999,
"query": {
"bool": {
"must": [
{
"nested": {
"path": "contractAttributions",
"query": {
"bool": {
@razorcd
razorcd / gist:31c9ccddc78dd2a2f30f9135cd1002b6
Created May 17, 2017 07:34
query based on a nested field
POST http://localhost:9200/devices/_search
{
"query": {
"bool": {
"must": [
{
"nested": {
"path": "contractAttributions",
"query": {
"bool": {
@razorcd
razorcd / defaultEntity.java
Created May 17, 2017 07:12
ES Java - Spring settings
// more:
// https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/annotations/Setting.java
@Setting(settingPath = "es-default-settings.json")
@Mapping(mappingPath = "es-default-mappings.json")
public class DefaultEntity {
}
@razorcd
razorcd / Elasticsearch agregations with combined filters
Last active May 10, 2017 20:03
filters and returns aggregated data
{
"from" : 0,
"size" : 0,
"aggregations" : {
"contractFilter" : {
"filter" : {
"or" : {
"filters" : [ {
"and" : {
"filters" : [ {
{
"from": 0,
"size": 0,
"aggregations": {
"deviceFilter": {
"filter": {
"or": {
"filters": [
{
"and": {
@razorcd
razorcd / Elasticsearch agregations
Created April 21, 2017 15:32
Elasticsearch agregations
{
"from": 0,
"size": 0,
"aggregations": {
"deviceFilter": {
"filter": {
"or": {
"filters": [
{
"and": {
@razorcd
razorcd / Angular2 ngModel manipulation directive
Created November 11, 2016 15:05
Angular 2 directive that manipulates the `ngModel` value on every change.
import {Directive, Attribute} from 'angular2/core';
import {NgModel} from 'angular2/common';
@Directive({
selector: '[mask]',
host: {
'(keyup)' : 'onInputChange()'
}
})
export class MaskDirective{
@razorcd
razorcd / observableExample.ts
Created October 26, 2016 09:14
Angular2 - RXJS Observable example
import {Component} from '@angular/core';
import {Observable} from 'rxjs/Observable';
@Component({
selector: 'app',
template: `
<b>Angular 2 Component Using Observables!</b>
<h6 style="margin-bottom: 0">VALUES:</h6>
<div *ngFor="let value of values">- {{ value }}</div>
<style>
.dropdown-submenu {
position:relative;
& > .dropdown-menu {
top:0;
left:100%;
margin-top:-6px;
margin-left:-1px;
-webkit-border-radius:0 6px 6px 6px;
@razorcd
razorcd / commands.md
Created July 9, 2016 14:27 — forked from ondrej-kvasnovsky/commands.md
Commands to install and configure ElasticSearch on Ubuntu

Install ElasticSearch and Java

1  wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.0.1.deb
2  sudo dpkg -i elasticsearch-1.0.1.deb
3  sudo update-rc.d elasticsearch defaults 95 10
4  sudo add-apt-repository ppa:webupd8team/java
5  sudo apt-get update
6  sudo apt-get install oracle-java7-installer
7  java -version