Skip to content

Instantly share code, notes, and snippets.

View spinscale's full-sized avatar
💻

Alexander Reelsen spinscale

💻
View GitHub Profile
@spinscale
spinscale / Webserver.java
Created June 10, 2015 07:01
Undertow + jgroups-raft example
package de.spinscale.cluster;
import io.undertow.Undertow;
import io.undertow.server.handlers.PathTemplateHandler;
import io.undertow.util.HttpString;
import io.undertow.util.PathTemplateMatch;
import org.jgroups.JChannel;
import org.jgroups.raft.RaftHandle;
import org.jgroups.raft.blocks.ReplicatedStateMachine;
@spinscale
spinscale / query.json
Created July 10, 2015 14:04
filter broken
PUT /foo/bar/1
{
"field1" : "foo",
"field2" : "foo"
}
PUT /foo/bar/2
{
"field1" : "bar",
"field2" : "bar"
@spinscale
spinscale / output.txt
Created August 13, 2015 08:06
mvn dependency tree
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] Elasticsearch Build Resources
[INFO] Elasticsearch Rest API Spec
[INFO] Elasticsearch Parent POM
[INFO] Elasticsearch Core
[INFO] Elasticsearch Distribution
[INFO] Elasticsearch with all optional dependencies
@spinscale
spinscale / clorgrc
Created December 25, 2015 14:31
Elasticsearch clogrc configuration
# log levels
elasticsearch rule /\[INFO(\s*)]/ --> green match
elasticsearch rule /\[ERROR(\s*)]/ --> red match
elasticsearch rule /\[DEBUG(\s*)]/ --> yellow match
elasticsearch rule /\[TRACE(\s*)]/ --> yellow match
elasticsearch rule /\[WARN(\s*)]/ --> yellow match
# events
elasticsearch rule " new_master " --> bold cyan match
elasticsearch rule " added " --> bold cyan match
@spinscale
spinscale / index.js
Created January 11, 2016 09:02
Presentation counter
var fs = require('fs')
var _ = require('lodash')
var request = require('request')
var cheerio = require('cheerio')
var ProgressBar = require('progress');
var printf = require('printf');
var presentations = []
var data = fs.readFileSync('urls.txt', { encoding: 'UTF-8' }).split("\n")
@spinscale
spinscale / aggs.json
Created March 16, 2016 15:47
Aggregations using filtering
DELETE /hotels
POST /hotels/hotel/_bulk
{ "index" : { "_id" : 1 }}
{ "features": [ "wifi", "parking" ], "stars" : 1 }
{ "index" : { "_id" : 2 }}
{ "features": [ "pool", "parking" ], "stars" : 4 }
{ "index" : { "_id" : 3 }}
{ "features": [ "wifi", "pool" ], "stars" : 5 }
@spinscale
spinscale / log4j2.properties
Created November 3, 2016 08:35
colorful log4j logging properties for Elasticsearch
# Colorful output, if you are on the console only
#appender.console.layout.pattern = %highlight{[%d{ISO8601}][%-5p][%-25c{1.}] %marker%m%n}
appender.console.layout.pattern = %style{[%d{ISO8601}]}{cyan}%style{[%-5p]}{magenta}%style{[%-25c{1.}]}{green} %marker%m%n
@spinscale
spinscale / kv.json
Created December 19, 2016 14:27
kv in painless
POST _ingest/pipeline/_simulate
{
"pipeline" : {
"description": "A pipeline to do named entity extraction",
"processors": [
{
"script": {
"lang": "painless",
"inline": "ctx.params = [:] ; /&/.splitAsStream(ctx.x).forEach(pair -> { def x = /=/.split(pair); ctx.params[x[0]] = x[1]; })"
}
@spinscale
spinscale / console-examples
Created January 18, 2017 08:10
Queries vom Training
DELETE _all
GET index/_mapping
PUT index
{
"settings": {
"analysis": {
"analyzer": {
"my_analyzer": {
@spinscale
spinscale / ingest node example
Created January 18, 2017 11:55
ingest node example
DELETE _all
PUT _ingest/pipeline/rename_hostname
{
"processors": [
{
"rename": {
"field": "hostname",
"target_field": "host",
"ignore_missing": true