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 / How-To.md
Created February 10, 2023 16:27
Run testing OpenSearch cluster with a core plugin

The run task

OpenSearch has a built in gradle task run to spin up a testcluster.

This is a very useful feature for plugin authors expecially if they use the plugin template (which defines its own modification of run task). It gives author easy way how to spin up a new testcluster with their plugin deployed.

However, when it comes to "core" plugins (that is plugins in plugins folder) then the run task does not seem to be setup correctly to spin up a clus

@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":{
oc exec <es_pod> -c elasticsearch -- es_util --query=_cluster/settings?flat_settings=true -X PUT -d \
'{
"transient": {
"logger": {
"org.elasticsearch.ingest.openshift": "TRACE",
"org.elasticsearch.action": "DEBUG"
}
}
}'
{
"aliases": {
".all": {
}
},
"index_patterns": [
"app*"
],
"mappings": {
@lukas-vlcek
lukas-vlcek / gist:4673027
Last active January 19, 2021 15:03
Čeština v elasticsearch
#!/bin/sh
# download
wget http://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.20.4.zip
# unzip and start
unzip elasticsearch-0.20.4.zip
cd elasticsearch-0.20.4
# remove data in case you have defined some analyzers in the past (e.g. stop/start)
rm -rf data/
@lukas-vlcek
lukas-vlcek / gist:1075067
Created July 10, 2011 22:55
Test of attachments plugin
#!/bin/sh
host=localhost:9200
curl -X DELETE "${host}/test"
curl -X PUT "${host}/test" -d '{
"settings" : { "index" : { "number_of_shards" : 1, "number_of_replicas" : 0 }}
}'
@lukas-vlcek
lukas-vlcek / gist:a61aea97ebe4c2bf22651c3694e76c71
Last active August 9, 2019 12:03
Dots in fields problem when upgrading from ES2 to ES5
# Start fresh ES 2.4.6 with dots in field names enabled
$ ES_JAVA_OPTS="-Dmapper.allow_dots_in_name=true" ./bin/elasticsearch
# Index two documents with conflisting mappings (conflisting from the ES5 perspective)
# See: https://www.elastic.co/guide/en/elasticsearch/reference/2.4/dots-in-names.html#_upgrading_fields_with_dots_to_5_x
$ curl -X POST localhost:9200/test/type -d '{"foo.bar":1}'
{"_index":"test","_type":"type","_id":"AWx2N0zkYS6E_SuIWEKX","_version":1,"_shards":{"total":2,"successful":1,"failed":0},"created":true}
$ curl -X POST localhost:9200/test/type2 -d '{"foo":1}'
@lukas-vlcek
lukas-vlcek / gist:f659ad6157e185d6d869770fc660bccd
Created June 24, 2019 13:55
Example of "oc describe <pod>"
$ oc describe po ruby-ex-1-r72kx
Name: ruby-ex-1-r72kx
Namespace: lvlcek
Priority: 0
PriorityClassName: <none>
Node: ip-10-0-155-48.us-east-2.compute.internal/10.0.155.48
Start Time: Mon, 24 Jun 2019 14:58:56 +0200
Labels: app=ruby-ex
deployment=ruby-ex-1
deploymentconfig=ruby-ex
@lukas-vlcek
lukas-vlcek / gist:7a19dd6e66e3366e869114c58223e771
Last active January 22, 2019 13:29
5.x release tags of Prometheus ES plugin
Tag Correct hash Wrong hash Should have been Note
master, 5.x master, 5.x 5.x
5.6.14.0 0d0b738 c5794ed
5.6.13.1 1c24705 15d9cb3
5.6.13.0 9367988 2dafc5e
5.6.12.0 f50587e ce171c7
5.6.11.0 a4a149f 112bb35
5.6.10.0 89f9cb2 a08fdbf
5.6.9.1 ab155c7 27b1f30
$ gradle clean
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'prometheus-exporter'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not download build-tools.jar (org.elasticsearch.gradle:build-tools:6.5.3)
> Could not get resource 'https://repo.maven.apache.org/maven2/org/elasticsearch/gradle/build-tools/6.5.3/build-tools-6.5.3.jar'.
> Could not GET 'https://repo.maven.apache.org/maven2/org/elasticsearch/gradle/build-tools/6.5.3/build-tools-6.5.3.jar'. Received status code 403 from server: Forbidden