Giter VIP home page Giter VIP logo

Comments (4)

flobernd avatar flobernd commented on June 12, 2024

@giannik Thanks for reporting! Could you please include the request JSON payload in this issue as well (DisableDirectStreaming must be used to capture the request payload).

from elasticsearch-net.

giannik avatar giannik commented on June 12, 2024

@flobernd
here is the error with payload info


Unsuccessful (400) low level call on PUT: /default_testindexcc
 Exception: Request failed to execute. Call: Status code 400 from: PUT /default_testindexcc. ServerError: Type: mapper_parsing_exception Reason: "Failed to parse mapping: A dynamic template must be defined with a name" CausedBy: "Type: mapper_parsing_exception Reason: "A dynamic template must be defined with a name""

# Audit trail of this API call:
 - [1] BadResponse: Node: https://1a105802743d4f41b53ef6269761d4d1.us-central1.gcp.cloud.es.io/ Took: 00:00:00.3313462
# OriginalException: Elastic.Transport.TransportException: Request failed to execute. Call: Status code 400 from: PUT /default_testindexcc. ServerError: Type: mapper_parsing_exception Reason: "Failed to parse mapping: A dynamic template must be defined with a name" CausedBy: "Type: mapper_parsing_exception Reason: "A dynamic template must be defined with a name""
# Request:
{"mappings":{"_meta":{"last_task_id":0},"_source":{"enabled":true,"excludes":["ContentItem_DisplayText_Analyzed"]},"dynamic_templates":[{"*.Inherited":{"mapping":{"type":"keyword"},"match_mapping_type":"string","path_match":"\u0022*\u0022 \u002B IndexingConstants.InheritedKey"},"*.Ids":{"mapping":{"type":"keyword"},"match_mapping_type":"string","path_match":"\u0022*\u0022 \u002B IndexingConstants.IdsKey"}}],"properties":{"ContentItemId":{"type":"keyword"},"ContentItemVersionId":{"type":"keyword"},"ContentItem_Owner":{"type":"keyword"},"ContentItem_FullText":{"type":"keyword"},"ContentItem_ContentType":{"type":"keyword"},"ContentItem_ContainedPart":{"properties":{"Ids":{"type":"keyword"},"Order":{"type":"keyword"}},"type":"object"},"ContentItem_DisplayText":{"properties":{"Analyzed":{"type":"text"},"Normalized":{"type":"keyword"},"Keyword":{"type":"keyword"}},"type":"object"},"ContentItem_Vector":{"dims":1536,"index":true,"similarity":"cosine","type":"dense_vector"}}},"settings":{"analysis":{"analyzer":{"standard":{"type":"standard"}}}}}
# Response:
{"error":{"root_cause":[{"type":"mapper_parsing_exception","reason":"A dynamic template must be defined with a name"}],"type":"mapper_parsing_exception","reason":"Failed to parse mapping: A dynamic template must be defined with a name","caused_by":{"type":"mapper_parsing_exception","reason":"A dynamic template must be defined with a name"}},"status":400}


from elasticsearch-net.

flobernd avatar flobernd commented on June 12, 2024

@giannik Thanks for the reply. I can see the problem now: Instead of putting both templates in a single dictionary, you have to specify multiple dictionaries with a single item. This is how the Elasticsearch server expects the templates to be sent (I know.. it's not the most intuitive design decision, but it's probably like this for historical reasons).

This should work:

DynamicTemplates = new List<IDictionary<string, DynamicTemplate>>( new[]
{
    new Dictionary<string, DynamicTemplate>
    {
        {
            "*.Inherited",
            new DynamicTemplate()
            {
                MatchMappingType = "string",
                PathMatch = "\"*\" + IndexingConstants.InheritedKey",
                Mapping = new KeywordProperty()
            }
        }
    },
    new Dictionary<string, DynamicTemplate>
    {
        {
            "*.Ids",
            new DynamicTemplate()
            {
                MatchMappingType = "string",
                PathMatch = "\"*\" + IndexingConstants.IdsKey",
                Mapping = new KeywordProperty()
            }
        }
    }
})

from elasticsearch-net.

giannik avatar giannik commented on June 12, 2024

@flobernd thankyou.
That worked!

from elasticsearch-net.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.