Skip to content

Instantly share code, notes, and snippets.

View imotov's full-sized avatar

Igor Motov imotov

View GitHub Profile
@imotov
imotov / gist:1270503
Created October 7, 2011 15:20
Elasticsearch NPE during highlighting
#!/bin/sh
#
# Start 2 ES nodes with default settings before running this script
#
curl -XDELETE http://localhost:9200/testidx
curl -XPUT http://localhost:9200/testidx -d '{
"settings" : {
"index" : {
"number_of_shards" : 1,
"number_of_replicas" : 0
@imotov
imotov / gist:1292966
Created October 17, 2011 16:09
Return only first 100 characters of the field message
curl -XGET 'http://localhost:9200/twitter/tweet/_search' -d '{
"query": {
"query_string" : {
"query" : "*:*"
}
},
"script_fields" : {
"short_message" : {
"script" : "msg = doc.message; msg.empty ? msg.stringValue : msg.stringValue.substring(0,min(100,msg.stringValue.length()))"
}
logger:
gateway : DEBUG
index.gateway : DEBUG
index.shard.recovery : DEBUG
index.shard.service: DEBUG
http://www.lagom.nl/lcd-test/inversion.php#invpattern
ioreg -lw0 | grep IODisplayEDID | sed "/[^<]*</s///" | xxd -p -r | strings -6
@imotov
imotov / gist:2043697
Created March 15, 2012 11:11
Setting snowball as default analyzer
curl -XPUT http://localhost:9200/twitter -d '{
"settings" : {
"index" : {
"number_of_shards" : 1,
"number_of_replicas" : 1,
"analysis" : {
"analyzer": {
"default" : {
"type" : "snowball"
}
@imotov
imotov / gist:2043721
Created March 15, 2012 11:18
Setting analyzer for the _all field
curl -XPUT http://localhost:9200/twitter -d '{
"settings" : {
"index" : {
"number_of_shards" : 1,
"number_of_replicas" : 1
}
},
"mappings" : {
"tweet" : {
"_source" : { "enabled" : false },
@imotov
imotov / elasticsearch.yml
Created April 2, 2012 10:32
elasticsearch-jetty Basis Auth Configuration
http.type: com.sonian.elasticsearch.http.jetty.JettyHttpServerTransportModule
$ curl 'http://localhost:9200/testas/_analyze?field=name&text=Skani+varškė' && echo
šė{"tokens":[{"token":"skani","start_offset":0,"end_offset":5,"type":"<ALPHANUM>","position":1},{"token":"varškė","start_offset":6,"end_offset":12,"type":"<ALPHANUM>","position":2}]}
$ curl 'http://localhost:9200/testas/_analyze?field=name&text=varškė' && echo
šė{"tokens":[{"token":"varᅤᄀkᅣ","start_offset":0,"end_offset":7,"type":"<ALPHANUM>","position":1},{"token":"ラ","start_offset":7,"end_offset":8,"type":"<KATAKANA>","position":2}]}
curl 'http://localhost:9200/testas/_search' -d '{"query" : { "query_string" : {"query" : "name:varškė"} }}'
@imotov
imotov / test.sh
Created April 11, 2012 10:11
Specific analyzer per document repro
echo "Deleting the test index"
curl -XDELETE localhost:9200/test-idx
echo
echo "Creating the test index"
curl -XPUT localhost:9200/test-idx -d '{
"settings": {
"index" : {
"number_of_shards" : 1,
"number_of_replicas" : 0
}