Created
May 15, 2013 09:14
-
-
Save mahnunchik/5582669 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
curl -XDELETE 'http://localhost:9200/testindex' | |
echo "\nIndex deleted" | |
curl -XPOST 'http://localhost:9200/testindex' -d '{ | |
"settings": { | |
"analysis": { | |
"analyzer": { | |
"en_ru_analyzer": { | |
"type": "custom", | |
"tokenizer": "standard", | |
"filter": ["lowercase", "russian_morphology", "english_morphology", "my_stopwords"] | |
} | |
}, | |
"filter": { | |
"my_stopwords": { | |
"type": "stop", | |
"stopwords": "а,без,более,бы,был,была,были,было,быть,в,вам,вас,весь,во,вот,все,всего,всех,вы,где,да,даже,для,до,его,ее,если,есть,еще,же,за,здесь,и,из,или,им,их,к,как,ко,когда,кто,ли,либо,мне,может,мы,на,надо,наш,не,него,нее,нет,ни,них,но,ну,о,об,однако,он,она,они,оно,от,очень,по,под,при,с,со,так,также,такой,там,те,тем,то,того,тоже,той,только,том,ты,у,уже,хотя,чего,чей,чем,что,чтобы,чье,чья,эта,эти,это,я,a,an,and,are,as,at,be,but,by,for,if,in,into,is,it,no,not,of,on,or,such,that,the,their,then,there,thesethey,this,to,was,will,with" | |
} | |
} | |
} | |
}, | |
"mappings" : { | |
"testtype" : { | |
"properties" : { | |
"text" : { | |
"type" : "string", | |
"analyzer": "en_ru_analyzer" | |
}, | |
"created": { | |
type: "date" | |
}, | |
"coordinates": { | |
"type": "geo_point", | |
"lat_lon": true | |
} | |
}, | |
"_source" : { | |
"enabled" : true | |
}, | |
"_id": { | |
"index": "not_analyzed" | |
} | |
} | |
} | |
}' | |
echo "\nIndex created" | |
curl -XPUT 'http://localhost:9200/testindex/testtype/1' -d '{ | |
"_id": "1", | |
"created": "2012-01-01T17:00:00.000Z", | |
"coordinates": { | |
"lat": 1, | |
"lon": 1 | |
}, | |
"text": "У московского бизнесмена из автомобиля украли шесть миллионов рублей" | |
}' && echo | |
curl -XPUT 'http://localhost:9200/testindex/testtype/2' -d '{ | |
"_id": "2", | |
"created": "2012-02-01T17:00:00.000Z", | |
"coordinates": { | |
"lat": 2, | |
"lon": 2 | |
}, | |
"text": "Креативное агентство Jvision, запустило сервис, способствующий развитию автомобильного туризма в России." | |
}' && echo | |
curl -XPUT 'http://localhost:9200/testindex/testtype/3' -d '{ | |
"_id": "3", | |
"created": "2012-03-01T17:00:00.000Z", | |
"coordinates": { | |
"lat": 3, | |
"lon": 3 | |
}, | |
"text": "Просто авто" | |
}' && echo | |
curl -XPUT 'http://localhost:9200/testindex/testtype/4' -d '{ | |
"_id": "4", | |
"created": "2012-04-01T17:00:00.000Z", | |
"coordinates": { | |
"lat": 4, | |
"lon": 4 | |
}, | |
"text": "Японские автомобили вновь заняли в США первые места в рейтингах" | |
}' && echo | |
curl -XPUT 'http://localhost:9200/testindex/testtype/5' -d '{ | |
"_id": "5", | |
"created": "2012-05-01T17:00:00.000Z", | |
"coordinates": { | |
"lat": 5, | |
"lon": 5 | |
}, | |
"text": "Январский дефицит платежного баланса Японии превысил $5 млрд" | |
}' && echo | |
curl -XPUT 'http://localhost:9200/testindex/testtype/6' -d '{ | |
"_id": "6", | |
"created": "2012-06-01T17:00:00.000Z", | |
"coordinates": { | |
"lat": 6, | |
"lon": 6 | |
}, | |
"text": "Японская корпорация Sony представила новый смартфон под названием Xperia Sola" | |
}' && echo | |
curl -XPUT 'http://localhost:9200/testindex/testtype/7' -d '{ | |
"_id": "7", | |
"created": "2012-07-01T17:00:00.000Z", | |
"coordinates": null, | |
"text": "Без координат. Японская" | |
}' && echo | |
curl -XPOST 'http://localhost:9200/testindex/_refresh' && echo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment