Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

/*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
@kimchy
kimchy / gist:341658
Created March 23, 2010 21:09
custom token filter setting
# custom token filter settings
index:
analysis:
filter:
myFilter:
type: eg.MyTokenFilterFactory
param1: value1
@kimchy
kimchy / gist:341663
Created March 23, 2010 21:14
default analyzers changed to be similar to standard analyzer just with asciifolding filter
index:
analysis:
analyzer:
default:
tokenizer : standard
filter : [standard, lowercase, stop, asciifolding]
{
"discovery" : {
"zen" : {
"ping.unicast.hosts" : [
"host1:9300",
"host2:9300",
"host3:9300"
]
}
}
public static void main(String[] args) {
List<Node> nodes = new ArrayList<Node>();
for (int i = 0; i < 4; i++) {
nodes.add(NodeBuilder.nodeBuilder().node());
}
Node client = NodeBuilder.nodeBuilder().client(true).node();
CreateIndexResponse createIndexResponse = client.client().admin().indices().prepareCreate("test").execute().actionGet();
System.out.println("created index, ack = " + createIndexResponse.acknowledged());
SearchResponse searchResponse = client.prepareSearch()
.setQuery(matchAllQuery())
.setSize(35)
.setScroll(TimeValue.timeValueMinutes(2))
.addSort("field", SortOrder.ASC)
.execute().actionGet();
assertThat(searchResponse.hits().getTotalHits(), equalTo(100l));
assertThat(searchResponse.hits().hits().length, equalTo(35));
if (!groups.isEmpty()) {
// lets see if we can filter based on groups
boolean filter = true;
for (String group : reservation.getGroupNames()) {
if (groups.contains(group)) {
filter = false;
break;
}
}
if (filter) {
@kimchy
kimchy / upgrade_elasticsearch_0.9.0_to_0.10.0.groovy
Created August 23, 2010 22:37
upgrade elasticsearch from 0.9.x to 0.10.0 script
/**
* An upgrade script from FS gateway indices version 0.9.0 to 0.10.
*
* The script uses groovy, you can get it from here: http://groovy.codehaus.org/Download.
*
* Upgrade Process:
*
* 1. Stop indexing operations against the cluster.
* 2. Issue a flush command: curl -XPOST host:port/_flush
* 3. Issue a snapshot command: curl -XPOST host:port/_gateway/snapshot
{
"query" : {
"more_like_this" : {
"fields" : ["content", "title"],
"like_text" : "jetblue blew tire",
"min_term_freq" : 1
}
},
"from" : 2000
}
libtool: Version mismatch error. This is libtool 2.2.4, but the
libtool: definition of this LT_INIT comes from libtool 2.2.6b.
libtool: You should recreate aclocal.m4 with macros from libtool 2.2.4
libtool: and run autoconf again.
make[3]: *** [thrift] Error 63
make[2]: *** [all] Error 2
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2