Closed ahermes closed 1 month ago
Hello, I think you're using the wrong mapping type here. The documentation shows that analyzer
is used with a text
type mapping, while you're using keyword which doesn't support analyzer
.
Hello, thanks for your answer, but I'm unsure this is the case as it worked previously and the indice was created using this same mapping with the old API. Could you please send the source regarding the keyword
not supporting analyzer
?
Hello again! I have checked the server code thoroughly, I am now sure that keyword
does not support analyzer
. It's not in the list of parameters, whereas text
has it (it's called indexAnalyzer
but the actual name is analyzer
as shown here). The fact that the dynamic template creation works is because mapping
in dynamic_templates
is a Map that accepts anything, for example can I successfully create and retrieve something like this:
and it works ^^" . Another way to prove it is to try with a simple mapper (without dynamic template), and see that this is accepted:
PUT text_test
{
"mappings": {
"properties": {
"tags": {
"type": "text",
"analyzer": "standard"
}
}
}
}
while this returns unknown parameter [analyzer] on mapper [tags] of type [keyword]
:
PUT keyword_test
{
"mappings": {
"properties": {
"tags": {
"type": "keyword",
"analyzer": "standard"
}
}
}
}
I hope this clear things up!
Hello , Yes ! It is clearer. I followed your advice and modified my mapping, everything is working on my end.
Thanks again for your time ! 🙏
Java API client version
7.17.21
Java version
17
Elasticsearch Version
7.16.2
Problem description
When i try to put a mapping to an already created indice with these settings
I use a dynamic_template with an analyzer
which result in a JsonpMappingException for fields "analyzer" and "path_match" in the "mapping" section
Error deserializing co.elastic.clients.elasticsearch._types.mapping.KeywordProperty: Unknown field 'analyzer' (JSON path: dynamic_templates[0].designations.mapping.analyzer)
it is demonstrated in the documentation that it is usable that way. (indices created without any problem with this json with the java-high-level-api)
The way i send the request :