Skip to content

Instantly share code, notes, and snippets.

💭
🇫🇷 🇯🇵

renshuki

💭
🇫🇷 🇯🇵
Block or report user

Report or block renshuki

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@renshuki
renshuki / latency-of-curl-command.md
Created Feb 28, 2020
How to retrieve latency of a cURL command
View latency-of-curl-command.md
curl -o /dev/null -s -w 'Establish Connection: %{time_connect}s\nTTFB: %{time_starttransfer}s\nTotal: %{time_total}s\n'  https://your_endpoint_url:port
@renshuki
renshuki / kibana-how-to-set-max-memory.md
Created Feb 13, 2020
Kibana - How to set instance max memory / heap (NodeJS)
View kibana-how-to-set-max-memory.md

You'll need to set NODE_OPTIONS in your environment variables.

export NODE_OPTIONS="--max-old-space-size=2048"

(which equivalent to 2GB for example)

Please note a Kibana restart is needed

@renshuki
renshuki / logstash-split-csv-columns-multiple-events.md
Last active Jan 24, 2020
Logstash pipeline configuration - split CSV columns into multiple events
View logstash-split-csv-columns-multiple-events.md

CSV Sample

col1,col2,col3
0,1,2
3,4,5
6,7,8

Code

@renshuki
renshuki / elasticsearch-bulk-index-from-json-hits.md
Last active Jan 8, 2020
Elasticsearch - Bulk index from a JSON file hits (with jq)
View elasticsearch-bulk-index-from-json-hits.md
cat file.json | jq -c '.hits.hits[] | { index: {_index:._index, _type:._type, _id:._id}}, ._source' | curl -XPOST -H "Content-Type: application/x-ndjson" localhost:9200/_bulk --data-binary @- | jq .
@renshuki
renshuki / elasticsearch-return-json-output-single-existing-field.md
Created Nov 11, 2019
Elasticsearch - Return JSON output with a single existing field
View elasticsearch-return-json-output-single-existing-field.md
GET .monitoring-es*/_search
{
  "_source": ["node_stats.process.cpu.percent"],
  "size": 200,
  "query": {
   "exists": {
     "field": "node_stats.process.cpu.percent"
   }
  }
@renshuki
renshuki / painless_script_compare_current_date_with_index_date.md
Created Oct 16, 2019
Elasticsearch - Painless script to compare the current date with a date already indexed into a document
View painless_script_compare_current_date_with_index_date.md

Elasticsearch Painless script which aims to calculate the difference in days between a date indexed into a document and the current date.

GET days_compare/_search
{
  "script_fields": {
    "diffdate": {
      "script": {
        "lang":   "painless",
        "source": """
@renshuki
renshuki / configuration_lowercase_tokenizer_example.md
Last active Oct 15, 2019
Elasticsearch - Configuration example of lowercase tokenizer for an index
View configuration_lowercase_tokenizer_example.md
PUT my_lowercase_tokenizer/
{
  "settings": {
    "analysis": {
      "analyzer": {
        "my_custom_analyzer": {
          "tokenizer": "lowercase"
        }
      }
@renshuki
renshuki / kibana_scripted_field_conditional_value_check.md
Created Oct 2, 2019
Kibana scripted field conditional check for values not empty
View kibana_scripted_field_conditional_value_check.md
if (doc['field'].size() != 0) { 
 // Do what operation you need
}
@renshuki
renshuki / elasticsearch_filedatavisualizer_geopoint_ingest_pipeline_conversion.md
Created Sep 27, 2019
Elasticsearch CSV import via File Data Visualizer (ML) - Convert latitude and longitude column to geo_point using ingest pipeline
View elasticsearch_filedatavisualizer_geopoint_ingest_pipeline_conversion.md
  1. Choose your CSV file to import including your coordinates data and upload it

location.csv

lat,long, timestamp
41.12,-71.34,1569476964
38.85896,-106.01665,1569476964
65.47629,18.61576,1569476964
@renshuki
renshuki / elasticsearch.service
Created Jul 17, 2019
Elasticsearch 7.x Systemd startup script
View elasticsearch.service
[Unit]
Description=Elasticsearch
Documentation=http://www.elastic.co
Wants=network-online.target
After=network-online.target
[Service]
RuntimeDirectory=elasticsearch
PrivateTmp=true
Environment=ES_HOME=/usr/share/elasticsearch
You can’t perform that action at this time.