Skip to content
This repository was archived by the owner on Jun 1, 2024. It is now read-only.
This repository was archived by the owner on Jun 1, 2024. It is now read-only.

ElasicSearch 7.0 support #248

Closed
Closed
@kanadaj

Description

@kanadaj

ElasticSearch 7 isn't currently supported due to a change in how templates operate - the default keyword is not accepted anymore.

The new template has to completely ditch the default flag:

        private static object GetTemplateESv7(
            Dictionary<string, string> settings,
            string templateMatchString)
        {
            return new
            {
                index_patterns = new[] { templateMatchString },
                settings = settings,
                mappings = new
                {
                    dynamic_templates = new List<Object>
                    {
                        //when you use serilog as an adaptor for third party frameworks
                        //where you have no control over the log message they typically
                        //contain {0} ad infinitum, we force numeric property names to
                        //contain strings by default.
                        {
                            new
                            {
                                numerics_in_fields = new
                                {
                                    path_match = @"fields\.[\d+]$",
                                    match_pattern = "regex",
                                    mapping = new
                                    {
                                        type = "text",
                                        index = true,
                                        norms = false
                                    }
                                }
                            }
                        },
                        {
                            new
                            {
                                string_fields = new
                                {
                                    match = "*",
                                    match_mapping_type = "string",
                                    mapping = new
                                    {
                                        type = "text",
                                        index = true,
                                        norms = false,
                                        fields = new
                                        {
                                            raw = new
                                            {
                                                type = "keyword",
                                                index = true,
                                                ignore_above = 256
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    properties = new Dictionary<string, object>
                    {
                        {"message", new {type = "text", index = "true"}},
                        {
                            "exceptions", new
                            {
                                type = "nested",
                                properties = new Dictionary<string, object>
                                {
                                    {"Depth", new {type = "integer"}},
                                    {"RemoteStackIndex", new {type = "integer"}},
                                    {"HResult", new {type = "integer"}},
                                    {"StackTraceString", new {type = "text", index = "true"}},
                                    {"RemoteStackTraceString", new {type = "text", index = "true"}},
                                    {
                                        "ExceptionMessage", new
                                        {
                                            type = "object",
                                            properties = new Dictionary<string, object>
                                            {
                                                {"MemberType", new {type = "integer"}},
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            };
        }```

Also, upgrading from ES6 requires the deletion of the previous template:

DELETE /_template/serilog-events-template```

Maybe do a consistency check on the template via GET and automatically re-create the template for ES7 if there was an upgrade?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions