User Tools

Site Tools


elasticsearch

Elasticsearch

Quick Commands

Check Cluster Health
curl -XGET 'http://localhost:9200/_cluster/health?pretty=true'
Node Information
curl -XGET 'http://localhost:9200/_nodes?pretty=true'
List all shards
curl -XGET 'http://localhost:9200/_cat/shards'
Detailed Shard Information
curl -XGET 'http://localhost:9200/_cat/shards/filebeat?pretty=true'

Templates

Filebeat Template apache2 module

{
   "template": "filebeat-*",
   "version": 50001,
   "settings": {
      "index.refresh_interval": "5s",
      "number_of_replicas": 0
   },
   "mappings": {
      "_default_": {
         "dynamic_templates": [
            {
               "message_field": {
                  "path_match": "message",
                  "match_mapping_type": "string",
                  "mapping": {
                     "type": "text",
                     "norms": false
                  }
               }
            },
            {
               "string_fields": {
                  "match": "*",
                  "match_mapping_type": "string",
                  "mapping": {
                     "type": "text",
                     "norms": false,
                     "fields": {
                        "keyword": {
                           "type": "keyword",
                           "ignore_above": 256
                        }
                     }
                  }
               }
            }
         ],
         "properties": {
            "@timestamp": {
               "type": "date"
            },
            "@version": {
               "type": "keyword"
            },
            "beat.hostname": {
               "type": "string",
               "index": "not_analyzed",
               "ignore_above": 1024
            },
            "geoip": {
               "dynamic": true,
               "properties": {
                  "ip": {
                     "type": "ip"
                  },
                  "location": {
                     "type": "geo_point"
                  },
                  "latitude": {
                     "type": "half_float"
                  },
                  "longitude": {
                     "type": "half_float"
                  }
               }
            }
         }
      }
   }
}

Errors

Error on content type header
{"error":"Content-Type header [application/x-www-form-urlencoded] is not supported","status":406}

In order to fix issue specify header with your curl XPUT.

Original Post

| exmple
curl -XPUT 'localhost:9200/_settings' -H 'Content-Type: application/json' -d '
{
    "index" : {
        "number_of_replicas" : 0
    }
}'
elasticsearch.txt · Last modified: 2018/01/18 22:26 by k2patel