Skip to content

Instantly share code, notes, and snippets.

@djptek
djptek / account_ids.json
Created April 8, 2019 21:08
match account_ids
PUT my_index
{
"mappings": {
"_doc": {
"properties": {
"account_id": {
"type": "keyword"
}
}
}
@djptek
djptek / desert_island_disks.txt
Last active June 4, 2019 15:53
desert island disks
PUT desert_island_disks
{
"mappings": {
"_doc": {
"properties": {
"album": {
"type": "keyword"
},
"artist": {
"type": "keyword"
@djptek
djptek / delete_version_increments.txt
Created March 13, 2019 08:46
Looking at incrementing version after delete
# add a test doc
$ curl -X PUT server1:9200/test1/_doc/1 -H 'Content-Type: application/json' -d '{}'
{"_index":"test1","_type":"_doc","_id":"1","_version":1,"result":"created","_shards":{"total":2,"successful":1,"failed":0},"_seq_no":0,"_primary_term":1}
#delete the test doc, get a 200
$ curl -I -X DELETE server1:9200/test1/_doc/1
HTTP/1.1 200 OK
content-type: application/json; charset=UTF-8
content-length: 153
@djptek
djptek / my_kws.json
Created February 26, 2019 12:35
case insensitive keyword search
DELETE test
PUT test
{
"settings": {
"analysis": {
"analyzer": {
"my_case_insensitive_keyword": {
"type": "custom",
"char_filter": [],
@djptek
djptek / integer_as_keyword_mapping.txt
Created February 12, 2019 10:36
Map an integer field as keyword multi-field
DELETE my_index
PUT my_index
{
"mappings": {
"_doc": {
"properties": {
"ID": {
"type": "long",
"fields": {
@djptek
djptek / expunge
Created January 14, 2019 17:35
expunge
DELETE logs_server2
DELETE logs_server3
POST /_forcemerge?only_expunge_deletes=false&max_num_segments=100&flush=true
@djptek
djptek / Elasticsearch _endpoints
Created January 8, 2019 13:57
List of Elasticsearch Endpoints grep-ed from source
# output from
git clone https://github.com/elastic/elasticsearch.git
grep -r "controller.registerHandler" elasticsearch | sed -e "s/.*\/_/_/" -e "s/[\/\"].*//" | grep "^_" | sort -u
_ack
_activate
_alias
_aliases
_analyze
_authenticate
@djptek
djptek / Plotting lines with VEGA
Created January 7, 2019 16:59
Plot some lines using VEGA in Kibana
#############
# tidy up
DELETE benchmarking-results
# create a mapping to mandate single shard + apply date format
PUT benchmarking-results
{
"settings": {
"number_of_shards": 1,
"number_of_replicas": 0
@djptek
djptek / A visualization in Kibana.txt
Last active December 20, 2018 08:43
Basic Example: a Kibana Visualization + underlying Aggregation
Basic Example: a Kibana Visualization + underlying Aggregation
First, you need to create an “Index Pattern”. Kibana will use this to identify which Elasticsearch Indexes to include in your Visualization
1. Go to Kibana
2. Click “Management” in LH sidebar
3. Click “Index Patterns”
4. Click “Create index pattern”
5. In box “Index pattern” box replace “index-name-*” by “blogs*”
6. Click “> Next Step”
@djptek
djptek / 2019_fiestas_vs_comunidad_autonoma.txt
Created December 14, 2018 14:12
2019 Fiestas Nacionales/Comunidad Indexed to Elasticsearch
# up to the eggs trying to figure out when fiestas are next year?
# For 2019 I dumped the fiestas into Json, incuding:
# - Fiesta Nacional no sustituible
# - Fiesta Nacional respecto de la que no se ha ejercido la facultad de sustitución
# - Fiesta de Comunidad Autónoma
# Source: https://www.ccoo-servicios.es/archivos/anexo-BOE.pdf
# please check vs PDF in case of error & remember to add any city/local fiestas
# and then I indexed it in Elasticsearch