Skip to content

Instantly share code, notes, and snippets.

View clintongormley's full-sized avatar

Clinton Gormley clintongormley

  • Barcelona, Spain
View GitHub Profile
curl -XPUT 'http://127.0.0.1:9201/es_test_1/' -d '
{}
'
# {
# "ok" : true,
# "acknowledged" : true
# }
curl -XGET 'http://127.0.0.1:9201/_cluster/health?timeout=30s&wait_for_status=green'
[13:40:45,381][INFO ][node ] [Lorelei Travis] {elasticsearch/0.9.0-SNAPSHOT/2010-07-17T09:36:15}[19654]: initializing ...
[13:40:45,385][INFO ][plugins ] [Lorelei Travis] loaded []
[13:40:47,316][DEBUG][gateway.fs ] [Lorelei Travis] Latest metadata found at index [38]
[13:40:47,317][INFO ][node ] [Lorelei Travis] {elasticsearch/0.9.0-SNAPSHOT/2010-07-17T09:36:15}[19654]: initialized
[13:40:47,317][INFO ][node ] [Lorelei Travis] {elasticsearch/0.9.0-SNAPSHOT/2010-07-17T09:36:15}[19654]: starting ...
[13:40:47,408][INFO ][transport ] [Lorelei Travis] bound_address {inet[/127.0.0.1:9300]}, publish_address {inet[/127.0.0.1:9300]}
[13:40:48,766][INFO ][node ] [Starhawk] {elasticsearch/0.9.0-SNAPSHOT/2010-07-17T09:36:15}[19704]: initializing ...
[13:40:48,770][INFO ][plugins ] [Starhawk] loaded []
[13:40:50,460][INFO ][cluster.service ] [Lorelei Travis] new_master
@clintongormley
clintongormley / html_strip.sh
Created January 15, 2011 13:06
HTML Strip charfilter test for ElasticSearch
# Analyze text: "the <b>quick</b> bröwn <img src="fox"/> &quot;jumped&quot;"
curl -XPUT 'http://127.0.0.1:9200/foo/' -d '
{
"index" : {
"analysis" : {
"analyzer" : {
"test_1" : {
"char_filter" : [
"html_strip"
@clintongormley
clintongormley / gist:816627
Created February 8, 2011 15:54
ElasticSearch::QueryParser
NAME
ElasticSearch::QueryParser - Check or filter query strings
DESCRIPTION
Passing an illegal query string to ElasticSearch, the request will fail.
When using a query string from an external source, eg the keywords field
from a web search form, it is important to filter it to avoid these
failures.
You may also want to allow or disallow certain query string features, eg
@clintongormley
clintongormley / gist:816663
Created February 8, 2011 16:07
es_release_notes.pl
#!/usr/local/bin/perl
use strict;
use warnings;
my $Base_URL = 'http://github.com/api/v2/json/issues/';
my $User_Repo = 'elasticsearch/elasticsearch/';
my $Issue_URL = "http://github.com/${User_Repo}issues/issue/";
my @Groups = qw(breaking feature enhancement bug);
@clintongormley
clintongormley / gist:822246
Created February 11, 2011 11:53
ES logging
#===================================
sub log_request {
#===================================
my $self = shift;
my $log = $self->_log_fh or return;
my $server = shift;
my $params = shift;
my $data = $params->{data};
if ( defined $data ) {
# [Thu Feb 10 13:21:05 2011] Protocol: http, Server: 127.0.0.1:9200
curl -XGET 'http://127.0.0.1:9200/_cluster/health?timeout=30s&wait_for_status=green'
# [Thu Feb 10 13:21:05 2011] Response:
# {
# "number_of_data_nodes" : 3,
# "relocating_shards" : 0,
# "active_shards" : 0,
# "status" : "green",
# "cluster_name" : "es_test",
curl -XPUT 'http://localhost:9200/testme/testme' -d '{
streamType: "Feed",
tenantId: "1",
message: "bla bla bla post bla bla 1 bla",
description: "Description",
postDate:"2010-06-03T21:11:09+0300"
}'
curl -XPOST 'http://localhost:9200/testme/testme/_search' -d '{ sort:{postDate:{reverse:true}}, size:100, query : { bool : {must : [ {wildcard : { message : "*post*" }}, {term : { tenantId : "1" }} ] }} ,"highlight" : { "pre_tags" : ["<em class='highlight'>"], "post_tags" : ["</em>"], "fields" : {"message" : {"fragment_size" : 200, "number_of_fragments" : 1}}}}'
@clintongormley
clintongormley / gist:840245
Created February 23, 2011 10:18
Put mapping on multiple indices
# [Wed Feb 23 11:17:05 2011] Protocol: http, Server: 127.0.0.1:9200
curl -XPUT 'http://127.0.0.1:9200/foo/' -d '
{}
'
# [Wed Feb 23 11:17:05 2011] Response:
# {
# "ok" : true,
# "acknowledged" : true
# }
# [Wed Mar 2 16:59:10 2011] Protocol: http, Server: 127.0.0.1:9200
curl -XPUT 'http://127.0.0.1:9200/foo/' -d '
{
"mappings" : {
"bar" : {
"properties" : {
"text" : {
"index" : "not_analyzed",
"type" : "string"
}