Skip to content

Instantly share code, notes, and snippets.

View imotov's full-sized avatar

Igor Motov imotov

View GitHub Profile
# Clean the test index first
curl -XDELETE 'http://localhost:9200/sotest'
# Put Test Record
curl -XPUT 'http://localhost:9200/sotest/type1/1' -d '{
"content":"Some content with @someone mention",
"mentions":["someone"],
"userId":"4dff31eaf8815f4df04e2d62"
}'
# Returns --> {"ok":true,"_index":"sotest","_type":"type1","_id":"1","_version":1}
curl -XDELETE http://localhost:9200/stackoverflow
curl -XPUT http://localhost:9200/stackoverflow
curl -XPUT http://localhost:9200/stackoverflow/location/_mapping -d '{
"location" : {
"properties": {
"name": { "type": "string", "boost": 2.0, "analyzer": "snowball" },
{"ok":true,"acknowledged":true}{"ok":true,"acknowledged":true}{"ok":true,"acknowledged":true}{"ok":true,"_index":"stackoverflow","_type":"location","_id":"1","_version":1}
{"ok":true,"_index":"stackoverflow","_type":"location","_id":"2","_version":1}
{"ok":true,"_index":"stackoverflow","_type":"location","_id":"3","_version":1}
{
"took" : 4,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
@imotov
imotov / gist:1242765
Created September 26, 2011 17:15
Missing JUnit dependency in groovy plugin
imotov-mac:tests imotov$ git clone https://github.com/elasticsearch/elasticsearch.git
Cloning into elasticsearch...
remote: Counting objects: 77061, done.
remote: Compressing objects: 100% (24522/24522), done.
remote: Total 77061 (delta 44284), reused 75308 (delta 42717)
Receiving objects: 100% (77061/77061), 14.42 MiB | 1.60 MiB/s, done.
Resolving deltas: 100% (44284/44284), done.
imotov-mac:tests imotov$ cd elasticsearch/
imotov-mac:elasticsearch imotov$ ./gradlew test
:jarjar:compileJava UP-TO-DATE
@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 },