Skip to content

Instantly share code, notes, and snippets.

View xeraa's full-sized avatar
🎩
DevRel

Philipp Krenn xeraa

🎩
DevRel
View GitHub Profile
@xeraa
xeraa / commands.sh
Created February 11, 2022 17:18
Elastic 8.0 security by default: Minimal setup with Docker for a 3 node cluster + Kibana
// Start the first node and keep the generated security credentials handy
docker run -e ES_JAVA_OPTS="-Xms1g -Xmx1g" -p 9200:9200 -it docker.elastic.co/elasticsearch/elasticsearch:8.0.0
// Check if the node has started correctly
curl --insecure --user elastic https://localhost:9200/
// Add your second node
docker run -e ENROLLMENT_TOKEN="..." -e ES_JAVA_OPTS="-Xms1g -Xmx1g" -it docker.elastic.co/elasticsearch/elasticsearch:8.0.0
// Check if it has joined the cluster
@xeraa
xeraa / search_as_you_type
Created March 15, 2021 11:01
Elasticsearch's search_as_you_type and completion suggester fields in action
PUT jobs
{
"mappings": {
"properties": {
"title": {
"type": "search_as_you_type"
}
}
}
}
PUT test/_doc/1
{
"test A": "a",
"test B": "b"
}
GET test/_search
{
"query": {
"match": {
"test A": "a"
PUT test
{
"mappings": {
"properties": {
"linked_ent": {
"type": "nested",
"properties": {
"score": {
"type": "float"
}
GET /
GET /_analyze
{
"analyzer": "english",
"text": "These are not the droids you are looking for."
}
@xeraa
xeraa / painless-split-example.json
Last active August 2, 2019 01:51
Painless split example
DELETE test
PUT test
{
"mappings": {
"properties": {
"url": {
"type": "keyword"
}
}
PUT _template/sample
{
"index_patterns": ["sample-*"],
"version": 27,
"settings": {
"index.refresh_interval": "5s",
"number_of_shards": 4,
"number_of_replicas": 1
},
"mappings": {
@xeraa
xeraa / console.json
Created February 26, 2019 05:07
Synonym graph in Elasticsearch with an updated synonym list
PUT /test_index
{
"settings": {
"index": {
"analysis": {
"analyzer": {
"synonym_analyzer": {
"tokenizer": "standard",
"filter": [
"synonym_graph"
@xeraa
xeraa / .env
Last active December 18, 2018 13:33
Zusammengesetzte Worte in Elasticsearch
ELASTIC_VERSION=6.5.3
@xeraa
xeraa / kibana.json
Created October 16, 2018 08:20
Retrieving a copy_to field in Elasticsearch (Kibana syntax)
DELETE my_index
PUT my_index
{
"settings": {
"number_of_shards": 1
},
"mappings": {
"_doc": {
"properties": {
"first_name": {