Last active
August 29, 2015 14:01
-
-
Save icedfish/d636c10818cbdb4b550f to your computer and use it in GitHub Desktop.
Logstash Mapping 说明
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -XPUT 'http://localhost:9200/_template/logstash_default' -d @/<path>/xxxx.json | |
# template的mapping和普通mapping略有不同 | |
# 需要在settings前面增加一行 | |
# 非常适合logstash的场景,所以本例中以logstash做sample。 | |
# 相关文档: http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-templates.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"template": "logstash-*", | |
"settings": { | |
"index.cache.field.type": "soft", | |
"index": { | |
"refresh_interval": "5s", | |
"number_of_shards": 10, | |
"number_of_replicas": 0, | |
"date_detection": false, | |
"numeric_detection": true, | |
"query": { | |
"default_field": "uri" | |
}, | |
"store": { | |
"compress": { | |
"stored": true, | |
"tv": true | |
} | |
} | |
} | |
}, | |
"mappings": { | |
"_default_": { | |
"_all": { | |
"enabled": false | |
}, | |
"_source": { | |
"compress": true | |
}, | |
"_type": { | |
"path": "tags", | |
"enabled": true | |
}, | |
"dynamic_templates": [ | |
{ | |
"template_string": { | |
"match": "*", | |
"match_mapping_type": "string", | |
"mapping": { | |
"type": "string", | |
"index": "not_analyzed" | |
} | |
} | |
}, | |
{ | |
"template_long": { | |
"match": "*", | |
"match_mapping_type": "long", | |
"mapping": { | |
"ignore_malformed": true | |
} | |
} | |
}, | |
{ | |
"template_float": { | |
"match": "*", | |
"match_mapping_type": "float", | |
"mapping": { | |
"ignore_malformed": true | |
} | |
} | |
}, | |
{ | |
"template_double": { | |
"match": "*", | |
"match_mapping_type": "double", | |
"mapping": { | |
"ignore_malformed": true | |
} | |
} | |
} | |
], | |
"properties": { | |
"ip": { | |
"type": "ip" | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment