Last active
August 17, 2021 00:28
-
-
Save allanbatista/8f69fa0b676c4bd8b5f2735f511ad184 to your computer and use it in GitHub Desktop.
Criação de Templates no elasticsearch
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
# POST http://localhost:9200/_template/default_template | |
{ | |
"template": "*", | |
"mappings": { | |
"dynamic_templates": [ | |
{ | |
"timestamp": { | |
"match": "*_at", | |
"mapping": { | |
"type": "date", | |
"format": "strict_date_optional_time||epoch_millis" | |
} | |
} | |
}, | |
{ | |
"integers": { | |
"match_mapping_type": "long", | |
"mapping": { | |
"type": "integer" | |
} | |
} | |
}, | |
{ | |
"strings": { | |
"match_mapping_type": "string", | |
"mapping": { | |
"type": "text", | |
"fields": { | |
"raw": { | |
"type": "keyword", | |
"ignore_above": 256 | |
} | |
} | |
} | |
} | |
} | |
] | |
} | |
} |
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
POST /_template/template_logs | |
{ | |
"template": "logs*", | |
"mappings": { | |
"log": { | |
"properties": { | |
"host": { | |
"index": "not_analyzed", | |
"type": "string" | |
}, | |
"server_name": { | |
"index": "not_analyzed", | |
"type": "string" | |
}, | |
"hostname": { | |
"index": "not_analyzed", | |
"type": "string" | |
}, | |
"request": { | |
"type": "object", | |
"properties": { | |
"url": { | |
"index": "not_analyzed", | |
"type": "string" | |
}, | |
"method": { | |
"index": "not_analyzed", | |
"type": "string" | |
}, | |
"params": { | |
"type": "string" | |
}, | |
"fullpath": { | |
"index": "not_analyzed", | |
"type": "string" | |
}, | |
"origin_ip": { | |
"index": "not_analyzed", | |
"type": "string" | |
}, | |
"headers": { | |
"index": "not_analyzed", | |
"type": "string" | |
} | |
} | |
}, | |
"sale_system": { | |
"index": "not_analyzed", | |
"type": "string" | |
}, | |
"response": { | |
"type": "object", | |
"properties": { | |
"status": { | |
"type": "integer" | |
}, | |
"body": { | |
"index": "not_analyzed", | |
"type": "string" | |
} | |
} | |
}, | |
"created_at": { | |
"format": "yyyy-MM-dd'T'HH:mm:ssZZ", | |
"type": "date" | |
}, | |
"account": { | |
"type": "object", | |
"properties": { | |
"name": { | |
"index": "not_analyzed", | |
"type": "string" | |
}, | |
"id": { | |
"index": "not_analyzed", | |
"type": "string" | |
}, | |
"active": { | |
"type": "boolean" | |
} | |
} | |
}, | |
"api_manager": { | |
"type": "object", | |
"properties": { | |
"token": { | |
"index": "not_analyzed", | |
"type": "string" | |
}, | |
"description": { | |
"index": "not_analyzed", | |
"type": "string" | |
} | |
} | |
} | |
} | |
} | |
} | |
} |
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": "synchronizer-logs-*", | |
"mappings": { | |
"log": { | |
"dynamic_templates": [ | |
{ | |
"dimensions": { | |
"match_mapping_type": "string", | |
"mapping": { | |
"type": "string", | |
"index": "not_analyzed" | |
} | |
} | |
} | |
], | |
"properties": { | |
"created_at": { | |
"type": "date", | |
"format": "yyyy-MM-dd'T'HH:mm:ssZZ" | |
}, | |
"type": { | |
"type": "string", | |
"index": "not_analyzed" | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment