Comments (4)
@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.
@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.
@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.
@flobernd thankyou.
That worked!
from elasticsearch-net.
Related Issues (20)
- Migration issues Templates and Dynamic queries HOT 5
- Client cannot deserialize string to list of strings HOT 4
- [Feature] Elastic 8 - MatchAll won't accept passing nothing HOT 1
- Creating a local stack s3 repository failed. use Postman works, but code calls are not working.
- [FEATURE] Elastic 8 Client - Stores Enums as Strings HOT 5
- Cannot use RawJsonQuery HOT 6
- Encountered an unsupported variant tag '' on 'Analysis.INormalizer', which could not be deserialized
- Simplify IndexAsync Abstraction to Infer Index Name from TDocument Type HOT 3
- Lacks the ability to put aggregations into aggregations HOT 5
- Elasticsearch 8.13 documentation not available when NuGet update is available HOT 1
- Deserializing type hierarchies doesn't seem to work HOT 10
- Update index settings with PutSettingsAsync fails with error status code 400: "request body is required" HOT 1
- Failing to deserialize response for `GetIndexAsync` HOT 5
- Cannot retrieve mapping of index with `icu_collation_keyword` field HOT 6
- cannot instantiate new DynamicTemplate when creating index. HOT 4
- Default index is not used in query with 8.13.15 client HOT 1
- Missing properties in aggregation API HOT 3
- Improve documentation for error handling
- Elastic.Transport.UnexpectedTransportException when calling elasticClient.MachineLearning.InferTrainedModelAsync
- Support for using input_output option in inference processor
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from elasticsearch-net.