Skip to content

Instantly share code, notes, and snippets.

View xeraa's full-sized avatar
🥑
Developer

Philipp Krenn xeraa

🥑
Developer
View GitHub Profile
@xeraa
xeraa / esql.console
Last active February 9, 2024 19:29
ES|QL examples
See https://xeraa.net/talks/elasticsearch-piped-query-language-esql/ for an updated version :)
@xeraa
xeraa / rrf-console.json
Last active October 12, 2023 10:00
Reciprocal Rank Fusion
GET bytes-discuss-dense-search/_search
{
"query": {
"multi_match": {
"fields": [ "title" ],
"query": "I don't know how to use ingest pipelines"
}
},
"size": 6,
"fields": [ "title" ],
@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"