Skip to content

Instantly share code, notes, and snippets.

@djptek
djptek / elasticsearch_json_example_requests.txt
Last active September 26, 2018 13:01
Training subscription draw at Elastic{ON} 2018
# permit regex to create a matcher for email domain
# ensure this setting has been enabled in elasticsearch.yml
# script.painless.regex.enabled: true
# define the ingest pipeline
PUT _ingest/pipeline/email_to_id_route_and_redact
{
"description": "use Ticket_Reference_ID as _id to dedupe, route by domain and redact ALL potential PII",
"processors": [
{
@djptek
djptek / parent_child.txt
Last active June 12, 2018 09:32
Parent Child example
DELETE chat
PUT chat
{
"settings": {
"index": {
"number_of_shards": "1",
"number_of_replicas": "1"
}
},
@djptek
djptek / asciidoc2solution.sh
Last active September 17, 2019 09:50
asciidoc to solution
#!/bin/bash
mkdir -p ../solutions
cat lab[1-4].asciidoc | sed -E "s/^\[\[(lab_[1-4])\]\]/### \1 ###/" | sed -e "s/^+$/#/" | grep -v "^[[+\.|-]" | grep -v "link:\|image:\|include:" | grep -e "^PUT\|^GET\|^DELETE\|^POST\|^#\|^[ ]*[{}\",]\|^ [ ]*[-0-9]\|\[\|\]\|ctx\." | sed '$!N; /^\(.*\)\n\1$/!P; D' > ../solutions/labs_1-4_solutions.txt
# (updated 2019/07/05 thanks @pmusa)
###########
GET _ingest/processor/grok
POST _ingest/pipeline/_simulate
{
"pipeline": {
"description": "parse major.minor.patch to sub-fields",
"processors": [
POST _reindex
{
"source": {
"index": "has-type-doc"
},
"dest": {
"index": "has-type-_doc"
},
"script": {
"source": "ctx._type = '_doc';",
@djptek
djptek / 3673.rb
Last active July 31, 2018 12:40
test code and results for issue 3673
def b2s (b)
if b
r = :true
else
r = :false
end
return r
end
puts "%12s |%12s |%12s |%12s |%32s" % [:arrays,:multi_prop,:updates,:wont_fit,:outcomes]
http://0.0.0.0:9200/_all/_stats?filter_path=_all.primaries.translog
{
"_all" : {
"primaries" : {
"translog" : {
"operations" : 0,
"size_in_bytes" : 110,
"uncommitted_operations" : 0,
"uncommitted_size_in_bytes" : 110,
@djptek
djptek / dutch_stemmers.txt
Created October 3, 2018 13:06
Comparing Dutch Stemmers
# take a look at the difference between these 2 examples, you can cut and paste them into Kibana
# Standard Dutch
POST _analyze
{
"tokenizer": "standard",
"filter": [
"standard",
"lowercase",
{
"type": "stemmer",
@djptek
djptek / _reindex_merge.txt
Created October 3, 2018 13:07
_reindex merge using wildcard
DELETE my_*
PUT _template/template_1
{
"index_patterns": ["*"],
"order": 1,
"settings": {
"number_of_shards": 1,
"number_of_replicas": 0
}
@djptek
djptek / es_settings.txt
Created October 3, 2018 13:13
Elasticsearch default settings
# cluster settings
http://0.0.0.0:9200/_cluster/settings?pretty=true&include_defaults=true
# index settings
http://0.0.0.0:9200/_all/_settings
# nodes settings
http://0.0.0.0:9200/_nodes/_all?pretty=true
# nodes os