Skip to content

Instantly share code, notes, and snippets.

View jprante's full-sized avatar
💤
Dormant

Jörg Prante jprante

💤
Dormant
View GitHub Profile
@jprante
jprante / multifield.json
Created May 14, 2012 10:21
Multi-field
"title" : {
"type" : "multi_field",
"fields" : {
"title" : {
"type" : "string",
"search_analyzer" : "str_search_analyzer",
"index_analyzer" : "str_index_analyzer"
},
"title_sort" : {
"index" : "not_analyzed"
@jprante
jprante / oai-es.sh
Created May 17, 2012 21:47
Harvesting an OAI data provider with Elasticsearch in a single line
# see https://github.com/jprante/elasticsearch-river-oai
# harvest
curl -XPUT 'localhost:9200/_river/aachen/_meta' -d '{
"type" : "oai",
"oai" : {
"url" : "http://darwin.bth.rwth-aachen.de/opus3/oai2/oai2.php",
"set" : "pub-type:8"
}
syn-setup.json:
{
"settings": {
"index" : {
"analysis" : {
"analyzer" : {
"synonym" : {
"tokenizer" : "whitespace",
"filter" : ["synonym"]
@jprante
jprante / gist:3047912
Created July 4, 2012 15:35
Elasticsearch parent/child
curl -XDELETE 'http://localhost:9200/test/'
curl -XPOST 'http://localhost:9200/_refresh'
curl -XPUT 'http://localhost:9200/test/' -d '{
"mappings" : {
"title" : {
},
"library" : {
"_parent" : {
"type" : "title"
}
@jprante
jprante / mapping.json
Created July 9, 2012 20:52
dc:contributor / dc:creator mapping
{
"title" : {
"_timestamp" : {
"enabled" : true,
"path" : "xbib:updated"
},
"_boost" : {
"name" : "xbib:boost",
"null_value" : 1.0
},
@jprante
jprante / gist:3153172
Created July 20, 2012 20:58
Wikipedia river
./bin/elasticsearch -f
[2012-07-20 22:55:59,016][INFO ][node ] [Dirtnap] {0.19.8}[30505]: initializing ...
[2012-07-20 22:55:59,025][INFO ][plugins ] [Dirtnap] loaded [river-wikipedia], sites []
[2012-07-20 22:56:00,987][INFO ][node ] [Dirtnap] {0.19.8}[30505]: initialized
[2012-07-20 22:56:00,989][INFO ][node ] [Dirtnap] {0.19.8}[30505]: starting ...
[2012-07-20 22:56:01,083][INFO ][transport ] [Dirtnap] bound_address {inet[/0.0.0.0:9300]}, publish_address {inet[/192.168.1.113:9300]}
[2012-07-20 22:56:04,163][INFO ][cluster.service ] [Dirtnap] new_master [Dirtnap][YD0w1fNHROuCn35WMQCKSg][inet[/192.168.1.113:9300]], reason: zen-disco-join (elected_as_master)
[2012-07-20 22:56:04,195][INFO ][discovery ] [Dirtnap] elasticsearch/YD0w1fNHROuCn35WMQCKSg
[2012-07-20 22:56:04,214][INFO ][http ] [Dirtnap] bound_address {inet[/0.0.0.0:9200]}, publish_address {inet[/192.168.1.113:9200
@jprante
jprante / gist:3252443
Created August 3, 2012 23:06
ICU folding tokenizer filter in action
curl -XDELETE 'http://localhost:9200/test/'
curl -XPOST 'http://localhost:9200/test' -d '{
"settings" : {
"index" : {
"analysis" : {
"analyzer" : {
"icu" : {
"type" : "custom",
"tokenizer" : "icu_tokenizer",
@jprante
jprante / gist:3664968
Created September 7, 2012 10:27
accessing node stats
package myPluginPackage;
import org.elasticsearch.common.component.AbstractComponent;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.node.service.NodeService;
import org.elasticsearch.action.admin.cluster.node.stats.NodeStats;
public class MyClassInAPlugin extends AbstractComponent {
@jprante
jprante / gist:3756035
Created September 20, 2012 13:49
Simple mapping
curl -XPUT 'http://localhost:9200/topic/document/_mapping' -d '
{
"document" : {
"properties" : {
"subject" : { "type" : "string" },
"post" : { "type" : "string" },
"plz" : { "type" : "string" },
"position" : { "type" : "geo_point" }
}
}
@jprante
jprante / gist:3987668
Created October 31, 2012 15:27
MongoDB river not working
Jorg-Prantes-MacBook-Pro:mongodb-osx-x86_64-2.2.1 joerg$ mkdir -p data/rs0-0
Jorg-Prantes-MacBook-Pro:mongodb-osx-x86_64-2.2.1 joerg$ ./bin/mongod --dbpath data/rs0-0 --port 27017 --replSet rs0
Wed Oct 31 15:57:06 [initandlisten] MongoDB starting : pid=13387 port=27017 dbpath=data/rs0-0 64-bit host=Jorg-Prantes-MacBook-Pro.local
Wed Oct 31 15:57:06 [initandlisten] db version v2.2.1, pdfile version 4.5
Wed Oct 31 15:57:06 [initandlisten] git version: d6764bf8dfe0685521b8bc7b98fd1fab8cfeb5ae
Wed Oct 31 15:57:06 [initandlisten] build info: Darwin erh-tnt.local 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun 7 16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386 i386 BOOST_LIB_VERSION=1_49
Wed Oct 31 15:57:06 [initandlisten] options: { dbpath: "data/rs0-0", port: 27017, replSet: "rs0" }
Wed Oct 31 15:57:06 [initandlisten] journal dir=data/rs0-0/journal
Wed Oct 31 15:57:06 [initandlisten] recover : no journal files present, no recovery needed
Wed Oct 31 15:57:06 [websvr] admin web console waiting for connections on