Skip to content

Instantly share code, notes, and snippets.

@Avatah
Avatah / gist:2693858
Created May 14, 2012 13:10
ElasticSearch parent child mapping & ttl on parent
curl -XPUT http://localhost:9200/test/parent/_mapping -d '{"parent" : {"_ttl": {"enabled": true}}}'
curl -XPUT http://localhost:9200/test/child/_mapping -d '{"child": {"_parent": {"type": "parent"}} }'
curl -XPUT http://localhost:9200/test/parent/parent1?ttl=60000 -d '{"name" : "parent1"}'
curl -XPUT http://localhost:9200/test/child/child1?parent=parent1 -d '{"name" : "child1"}'
curl -XPUT http://localhost:9200/test/child/child2?parent=parent1 -d '{"name" : "child2"}'
@Avatah
Avatah / gist:1788431
Created February 10, 2012 10:12
Elastic Search date_format problem
ES 0.18.6 & ES 0.19.0.RC2
curl -XPUT http://localhost:9200/i
curl -XPUT http://localhost:9200/i/t1/_mapping -d '
{ "t1" : {
"dynamic_templates" : [
{
"no_analyze_strings" : {
"match_mapping_type" : "string",
@Avatah
Avatah / gist:1234552
Created September 22, 2011 11:08
java code for putMapping
Node node = NodeBuilder.nodeBuilder().local(true).loadConfigSettings(false).clusterName("testCluster").settings(
ImmutableSettings.settingsBuilder()
.put("gateway.type", "none")
.put("path.data", new File("target/data").getAbsolutePath())
.build()).node();
Client client = node.client();
for (int loop = 1; loop < 1000; loop++) {
String indexName = "testindex" + loop;
String typeName = "testType" + loop;
@Avatah
Avatah / gist:1178368
Created August 29, 2011 13:13
Modified test that checks if document can be get by id
var loop: Int = 1
while (true) {
val id = UUID.randomUUID().toString
def indexName = "testindex" + loop
def typeName = "testType" + loop
val node = NodeBuilder.nodeBuilder().local(true).loadConfigSettings(false).clusterName("testCluster").settings(
ImmutableSettings.settingsBuilder
.put("gateway.type", "none")
// .put("index.store.type", "memory")
@Avatah
Avatah / gist:1178293
Created August 29, 2011 12:24
Elastic search 0.17.5 missing documents
val indexName = "testindex"
val typeName = "testType"
var loop: Int = 1
while (true) {
val node = NodeBuilder.nodeBuilder().local(true).loadConfigSettings(false).clusterName("testCluster").settings(
ImmutableSettings.settingsBuilder
.put("gateway.type", "none")
// .put("index.store.type", "memory")
@Avatah
Avatah / jstack.txt
Created August 9, 2011 10:43
Deadlock in ES 0.17.4
2011-08-09 12:39:17
Full thread dump Java HotSpot(TM) 64-Bit Server VM (16.2-b04 mixed mode):
"Attach Listener" daemon prio=10 tid=0x00007f5468007000 nid=0x5125 waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"elasticsearch[merge]-pool-184-thread-1" daemon prio=10 tid=0x00007f5464c6c000 nid=0x50c3 waiting on condition [0x00007f546cc38000]
java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for <0x00007f54c4783b78> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)