Skip to content

Instantly share code, notes, and snippets.

@nik9000
nik9000 / gist:5970277
Created July 10, 2013 20:58
Curl recreation of issue causing index to be un-openable
curl -XDELETE "http://localhost:9200/test_close?pretty=true"
# Create an index with a bunch of shards which should take a while
curl -XPOST "http://localhost:9200/test_close?pretty=true" -d '{
"settings": {
"number_of_shards": 1024,
"number_of_replicas": 3
}
}'
# Close the index real fast
curl -XPOST "http://localhost:9200/test_close/_close?pretty=true"
@nik9000
nik9000 / gist:6028478
Last active December 19, 2015 22:38
Can't reopen index if you closed it without enough nodes to host half the lucene indexes in each shard
# Launch two nodes
curl -XDELETE "http://localhost:9200/test_close?pretty=true"
# Create more replicas then we have nodes
curl -XPOST "http://localhost:9200/test_close?pretty=true" -d '{
"settings": {
"number_of_shards": 5,
"number_of_replicas": 3
}
}'
# Wait until all the shards that are going to allocate have allocated
# This works as expected:
# Cleanly launch three nodes
rm -rf data/elasticsearch/nodes/*
./bin/elasticsearch -p es1.pid
./bin/elasticsearch -p es2.pid
./bin/elasticsearch -p es3.pid
sleep 10
curl -XGET "http://localhost:9200/_cluster/health?pretty=true&wait_for_nodes=3"
# Create more replicas then we have nodes
curl -XPOST "http://localhost:9200/test_close?pretty=true" -d '{
@nik9000
nik9000 / gist:6225677
Created August 13, 2013 21:02
Phrase queries from query strings ignore boosts
curl -XDELETE "http://localhost:9200/test?pretty"
curl -XPOST "http://localhost:9200/test?pretty" -d '{
"settings": {
"index": {
"number_of_shards": 1,
"number_of_replicas": 0
}
}
}'
@nik9000
nik9000 / gist:6287620
Created August 20, 2013 21:33
Lack of confidence
#!/bin/bash
curl -XDELETE "http://localhost:9200/test?pretty" -s > log
curl -XPOST "http://localhost:9200/test?pretty" -s -d '{
"settings": {
"index": {
"number_of_shards": 5,
"number_of_replicas": 0,
"analysis":{
"analyzer":{
#!/bin/bash
curl -XDELETE http://localhost:9200/test?pretty
curl -XPUT http://localhost:9200/test?pretty
curl -XPUT http://localhost:9200/test/test/_mapping?pretty -d'{
"test" : {
"properties": {
"text" : {
"type": "string",
"store": "yes",
@nik9000
nik9000 / gist:6638883
Created September 20, 2013 15:02
Highlighting subfields
#!/bin/bash
curl -XDELETE "http://localhost:9200/test?pretty" -s
curl -XPOST "http://localhost:9200/test?pretty" -s
curl -XPUT http://localhost:9200/test/test/_mapping?pretty -d'{
"test" : {
"properties": {
"foo" : {
"type": "multi_field",
"fields": {
#!/bin/bash
curl -XDELETE "http://localhost:9200/test?pretty" -s
curl -XPOST "http://localhost:9200/test?pretty" -s
curl -XGET 'http://localhost:9200/_cluster/health?pretty=true&wait_for_status=yellow'
curl -XPOST "http://localhost:9200/test/test/1?pretty" -d '{"foo": "findme"}'
curl -XPOST "http://localhost:9200/test/test/2?pretty" -d '{"bar": "findme"}'
curl -XPOST http://localhost:9200/test/_refresh?pretty
@nik9000
nik9000 / gist:6645681
Created September 21, 2013 00:27
fvh doesn't sort array entries by score but plain highlighter does
#!/bin/bash
curl -XDELETE "http://localhost:9200/test?pretty" -s
curl -XPOST "http://localhost:9200/test?pretty" -s
curl -XPOST "http://localhost:9200/test?pretty" -s
curl -XPUT http://localhost:9200/test/test/_mapping?pretty -d'{
"test" : {
"properties": {
"foo" : {
"type": "string",
@nik9000
nik9000 / gist:8918627
Created February 10, 2014 16:09
TEST-org.elasticsearch.search.facet.termsstats.ShardSizeTermsStatsFacetTests.xml
<testsuite errors="15" failures="2" tests="15" skipped="0" name="org.elasticsearch.search.facet.termsstats.ShardSizeTermsStatsFacetTests" hostname="nohost.nodomain" time="381.23" timestamp="2014-02-10T10:50:52">
<properties class="java.util.ArrayList">
<property name="awt.toolkit" value="sun.awt.X11.XToolkit"/>
<property name="es.logger.level" value="INFO"/>
<property name="es.logger.prefix" value=""/>
<property name="es.node.local" value=""/>
<property name="es.node.mode" value=""/>
<property name="file.encoding" value="UTF-8"/>
<property name="file.encoding.pkg" value="sun.io"/>
<property name="file.separator" value="/"/>