Skip to content

Instantly share code, notes, and snippets.

View cdahlqvist's full-sized avatar

Christian Dahlqvist cdahlqvist

  • Independent
  • Valencia, Spain
View GitHub Profile
@cdahlqvist
cdahlqvist / error_message.txt
Last active September 6, 2016 02:01
Issue loading index template in ES 5.0.0-alpha5
The provided index template loading script works fine on ES 5.0.0-alpha4 but fails on ES 5.0.0-alpha5 with the following error message.
[2016-09-06 02:52:45,093][WARN ][http.netty4 ] [ECKV_Vw] caught exception while handling client http traffic, closing connection [id: 0x1ecebe60, L:/127.0.0.1:9200 - R:/127.0.0.1:64769]
java.lang.UnsupportedOperationException: unsupported message type: DefaultFullHttpResponse (expected: ByteBuf, FileRegion)
at io.netty.channel.nio.AbstractNioByteChannel.filterOutboundMessage(AbstractNioByteChannel.java:260)
at io.netty.channel.AbstractChannel$AbstractUnsafe.write(AbstractChannel.java:799)
at io.netty.channel.DefaultChannelPipeline$HeadContext.write(DefaultChannelPipeline.java:1291)
at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:748)
at io.netty.channel.AbstractChannelHandlerContext.invokeWriteAndFlush(AbstractChannelHandlerContext.java:811)
at io.netty.channel.AbstractChannelHandlerContext.write(AbstractCh
@cdahlqvist
cdahlqvist / sample_event.json
Created August 2, 2016 15:01
sample_event_and_mapping
{
"@timestamp": "2016-01-29T16:18:30.574Z",
"referrer": "https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping.html",
"verb": "GET",
"request": "/assets/blt6892ef667f7c28d7/icon-elasticsearch2.svg",
"geoip": {
"location": [87.3333, 22.3333],
"country_name": "India"
},
"agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.97 Safari/537.36",
#!/usr/bin/env perl
use LWP;
use HTTP::Request::Common;
my $url = "localhost:9200";
my $protocol = "http";
my $index_name_prefix = "shardtest";
my $counter = 0;
my $indexspec = '{"settings":{"index":{"number_of_shards":"100","number_of_replicas":"0"}}}';
#!/usr/bin/env perl
use POSIX;
my $KB = 1024;
my $MB = $KB*1024;
my $GB = $MB*1024;
my $TB = $GB*1024;
my %index_stats;
curl -XPOST http://localhost:9200/test/test -d'{
"title": "one",
"total": 10
}'
curl -XPOST http://localhost:9200/test/test -d'{
"title": "one",
"total": 10
}'
var http = require('http');
var fs = require('fs');
var optimist = require('optimist')
.usage('Simple web server to log incoming requests.\n\nUsage: $0 [options]')
.options({
file: {
alias: 'f',
describe: 'Path of file to log to. Server will log to stdout if no file specified.'
},
@cdahlqvist
cdahlqvist / gist:96d0d132c5586229345e
Last active August 29, 2015 14:19
GeoShape example
# Add mapping
curl -XPUT localhost:9200/restaurants -d '{
"mappings": {
"areas": {
"properties": {
"name": {
"type": "string"
},
"area": {
"type": "string"
Christians-MacBook-Air:nyc_traffic_accidents acd$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'puppetlabs/ubuntu-14.04-64-puppet' could not be found. Attempting to find and install...
default: Box Provider: virtualbox
default: Box Version: >= 0
==> default: Loading metadata for box 'puppetlabs/ubuntu-14.04-64-puppet'
default: URL: https://vagrantcloud.com/puppetlabs/ubuntu-14.04-64-puppet
==> default: Adding box 'puppetlabs/ubuntu-14.04-64-puppet' (v0.3.0) for provider: virtualbox
default: Downloading: https://vagrantcloud.com/puppetlabs/ubuntu-14.04-64-puppet/version/3/provider/virtualbox.box
==> default: Successfully added box 'puppetlabs/ubuntu-14.04-64-puppet' (v0.3.0) for 'virtualbox'!
@cdahlqvist
cdahlqvist / statslogger.py
Last active August 29, 2015 14:03
Simple script that logs a set of Riak statistics to a daily CSV file once a minute
#!/usr/bin/env python
import httplib
import json
from datetime import datetime, date, time
from time import sleep
import os.path
from multiprocessing import Process
Start a Riak 2.0 cluster. This has been tested against Riak 2.0.0pre11.
First set up bucket types (note you can name these as you like for your domain (and add other properties)
$ rel/riak/bin/riak-admin bucket-type create maps '{"props":{"datatype":"map"}}'
maps created
$ rel/riak/bin/riak-admin bucket-type create sets '{"props":{"datatype":"set"}}'
sets created
$ rel/riak/bin/riak-admin bucket-type create counters '{"props":{"datatype":"counter"}}'
counters created