Skip to content

Instantly share code, notes, and snippets.

View lukas-vlcek's full-sized avatar

Lukáš Vlček lukas-vlcek

View GitHub Profile
@lukas-vlcek
lukas-vlcek / gist:6039115
Created July 19, 2013 13:31
Torturing Word Delimiter TokenFilter in ElasticSearch
#!/bin/sh
curl -X DELETE 'localhost:9200/i/'
curl -X POST 'localhost:9200/i/' -d '{
"settings" : {
"analysis" : {
"analyzer" : {
"crazy" : {
"type" : "custom",
@lukas-vlcek
lukas-vlcek / gist:5846745
Last active October 10, 2018 06:54
Ukázka ICU Folding. Předpokládá Elasticsearch 0.90.0 a nainstalovaný ICU plugin 1.9.0
#!/bin/sh
curl -X DELETE 'localhost:9200/i/'
curl -X POST 'localhost:9200/i/' -d '{
"settings" : {
"number_of_shards" : 1,
"number_of_replicas" : 0,
"analysis" : {
"analyzer" : {
@lukas-vlcek
lukas-vlcek / gist:5846552
Last active December 18, 2015 21:19
Ukázka ICU Collation pro češtinu. Předpokládá Elasticsearch 0.90.0 a nainstalovaný ICU plugin 1.9.0
#!/bin/sh
curl -X DELETE 'localhost:9200/i/'
curl -X POST 'localhost:9200/i/' -d '{
"settings" : {
"number_of_shards" : 1,
"number_of_replicas" : 0,
"analysis" : {
"analyzer" : {
@lukas-vlcek
lukas-vlcek / gist:5805393
Last active December 18, 2015 15:39
Highlighting of HTML stripped content.
curl -X DELETE 'localhost:9200/i/'
curl -X POST 'localhost:9200/i/' -d '{
"settings" : {
"number_of_shards" : 1,
"number_of_replicas" : 0,
"analysis" : {
"analyzer" : {
"content" : {
"type" : "custom",
@lukas-vlcek
lukas-vlcek / gist:5764844
Created June 12, 2013 12:32
Or is this the correct way of setting compound format?
Settings settings = settingsBuilder()
.put("gateway.type", "local")
.put("index.number_of_shards", 1)
.put("index.compound_format", true) // ##### Here ?
.build();
Node node = NodeBuilder.nodeBuilder()
.settings(settings)
.local(true)
.node();
@lukas-vlcek
lukas-vlcek / gist:5764816
Last active December 18, 2015 09:58
Is this correct way to use compound format via Java API?
Settings settings = settingsBuilder()
.put("gateway.type", "local")
.put("index.number_of_shards", 1)
.put("index.compound_format", true) // ##### Here ?
.build();
Node node = NodeBuilder.nodeBuilder()
.settings(settings)
.local(true)
.node();
@lukas-vlcek
lukas-vlcek / gist:5143799
Last active February 7, 2023 21:50
Adding a new analyzer into existing index in Elasticsearch (requires close/open the index). Tested with Elasticsearch 0.19.12.
// create an index with an analyzer "myindex"
curl -X PUT localhost:9200/myindex -d '
{
"settings" : {`
"index":{
"number_of_replicas":0,
"number_of_shards":1,
"analysis":{
"analyzer":{
"first":{
@lukas-vlcek
lukas-vlcek / gist:5005428
Created February 21, 2013 15:22
Elasticsearch: Highlighting with nGrams (possible issue?)
curl -X PUT localhost:9200/myindex -d '
{
"settings" : {
"index":{
"number_of_replicas":0,
"number_of_shards":1,
"analysis":{
"analyzer":{
"default":{
"type":"custom",
@lukas-vlcek
lukas-vlcek / gist:5004752
Created February 21, 2013 13:33
Highlighting: String index out of range
org.elasticsearch.search.fetch.FetchPhaseExecutionException: [myindex][0]: query[filtered(code.code.ngram:sam code.code.ngram:xy)->cache(_type:product)],from[0],size[10]: Fetch Failed [Failed to highlight field [code.ngram]]
at org.elasticsearch.search.highlight.HighlightPhase.hitExecute(HighlightPhase.java:335)
at org.elasticsearch.search.fetch.FetchPhase.execute(FetchPhase.java:250)
at org.elasticsearch.search.SearchService.executeFetchPhase(SearchService.java:326)
at org.elasticsearch.search.action.SearchServiceTransportAction.sendExecuteFetch(SearchServiceTransportAction.java:243)
at org.elasticsearch.action.search.type.TransportSearchQueryAndFetchAction$AsyncAction.sendExecuteFirstPhase(TransportSearchQueryAndFetchAction.java:75)
at org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:205)
at org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:192)
@lukas-vlcek
lukas-vlcek / gist:4731127
Created February 7, 2013 14:10
Elasticsearch: Define custom analysers and common field mappings in index template
#!/bin/sh
curl -XPUT localhost:9200/index_1 -d'
{
settings: {
number_of_shards: 1,
number_of_replicas: 0
},
mappings: {
_default_ : {