Skip to content

Instantly share code, notes, and snippets.

@jprante
Created December 7, 2012 16:23
Show Gist options
  • Save jprante/4234406 to your computer and use it in GitHub Desktop.
Save jprante/4234406 to your computer and use it in GitHub Desktop.
Ein schöner Tag in Köln im Cafe
curl -XDELETE 'localhost:9200/ling'
echo '{
"settings" : {
"index" : {
"analysis" : {
"analyzer" : {
"default" : {
"type" : "custom",
"tokenizer" : "icu_tokenizer",
"filter" : [ "snowball", "icu_folding" ]
}
},
"filter" : {
"snowball" : {
"type" : "snowball",
"language" : "German2"
}
}
}
}
}
}' > settings.json
curl -XPUT 'localhost:9200/ling' --data-binary @settings.json
curl -XGET 'localhost:9200/ling/_settings?pretty'
echo '{
"sentence" : "Ein schöner Tag in Köln im Café"
}' > ling-1.json
echo '{
"sentence" : "Ein schoener Tag in Köln im Café"
}' > ling-2.json
echo '{
"sentence" : "Ein schoner Tag in Koln im Cafe"
}' > ling-3.json
curl -XPUT 'localhost:9200/ling/test/1' --data-binary @ling-1.json
curl -XPUT 'localhost:9200/ling/test/2' --data-binary @ling-2.json
curl -XPUT 'localhost:9200/ling/test/3' --data-binary @ling-3.json
curl -XGET 'localhost:9200/_refresh'
echo '{
"query": {
"match": {
"sentence": "Ein schöner Tag in Köln im Café"
}
}
}' > query-1.json
echo '{
"query": {
"match": {
"sentence": "Ein schoener Tag in Köln im Café"
}
}
}' > query-2.json
echo '{
"query": {
"match": {
"sentence": "Ein schoner Tag in Koln im Cafe"
}
}
}' > query-3.json
curl -XPOST 'localhost:9200/ling/test/_search?pretty' --data-binary @query-1.json
curl -XPOST 'localhost:9200/ling/test/_search?pretty' --data-binary @query-2.json
curl -XPOST 'localhost:9200/ling/test/_search?pretty' --data-binary @query-3.json
exit
######################################################################
{"ok":true,"acknowledged":true}{"ok":true,"acknowledged":true}{
"ling" : {
"settings" : {
"index.analysis.analyzer.default.filter.1" : "icu_folding",
"index.analysis.filter.snowball.language" : "German2",
"index.analysis.analyzer.default.filter.0" : "snowball",
"index.analysis.analyzer.default.tokenizer" : "icu_tokenizer",
"index.analysis.filter.snowball.type" : "snowball",
"index.analysis.analyzer.default.type" : "custom",
"index.number_of_shards" : "1",
"index.number_of_replicas" : "0",
"index.version.created" : "191199"
}
}
}{"ok":true,"_index":"ling","_type":"test","_id":"1","_version":1}{"ok":true,"_index":"ling","_type":"test","_id":"2","_version":1}{"ok":true,"_index":"ling","_type":"test","_id":"3","_version":1}{"ok":true,"_shards":{"total":1,"successful":1,"failed":0}}{
"took" : 4,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"failed" : 0
},
"hits" : {
"total" : 3,
"max_score" : 0.7541492,
"hits" : [ {
"_index" : "ling",
"_type" : "test",
"_id" : "1",
"_score" : 0.7541492, "_source" : {
"sentence" : "Ein schöner Tag in Köln im Café"
}
}, {
"_index" : "ling",
"_type" : "test",
"_id" : "2",
"_score" : 0.7541492, "_source" : {
"sentence" : "Ein schoener Tag in Köln im Café"
}
}, {
"_index" : "ling",
"_type" : "test",
"_id" : "3",
"_score" : 0.4865836, "_source" : {
"sentence" : "Ein schoner Tag in Koln im Cafe"
}
} ]
}
}{
"took" : 3,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"failed" : 0
},
"hits" : {
"total" : 3,
"max_score" : 0.7541492,
"hits" : [ {
"_index" : "ling",
"_type" : "test",
"_id" : "1",
"_score" : 0.7541492, "_source" : {
"sentence" : "Ein schöner Tag in Köln im Café"
}
}, {
"_index" : "ling",
"_type" : "test",
"_id" : "2",
"_score" : 0.7541492, "_source" : {
"sentence" : "Ein schoener Tag in Köln im Café"
}
}, {
"_index" : "ling",
"_type" : "test",
"_id" : "3",
"_score" : 0.4865836, "_source" : {
"sentence" : "Ein schoner Tag in Koln im Cafe"
}
} ]
}
}{
"took" : 2,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"failed" : 0
},
"hits" : {
"total" : 3,
"max_score" : 0.8401768,
"hits" : [ {
"_index" : "ling",
"_type" : "test",
"_id" : "3",
"_score" : 0.8401768, "_source" : {
"sentence" : "Ein schoner Tag in Koln im Cafe"
}
}, {
"_index" : "ling",
"_type" : "test",
"_id" : "1",
"_score" : 0.4367612, "_source" : {
"sentence" : "Ein schöner Tag in Köln im Café"
}
}, {
"_index" : "ling",
"_type" : "test",
"_id" : "2",
"_score" : 0.4367612, "_source" : {
"sentence" : "Ein schoener Tag in Köln im Café"
}
} ]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment