2

I need synonyms for searching my documents and mainly fellow this topic: Add synonym analyzer to elasticsearch index

POST /my_index/_close
PUT /my_index/_settings
{
 "settings": {
 "analysis": {
 "filter": {
 "my_synonym_filter": {
 "type": "synonym",
 "synonyms_path": "synonyms.txt",
 "updateable": true
 }
 },
 "analyzer": {
 "my_synonym_analyzer": {
 "tokenizer": "standard",
 "filter": [
 "lowercase",
 "my_synonym_filter"
 ]
 }
 }
 }
 }
}

Now I like to assign my_synonym_analyzer to the field content using this request:

PUT /my_index/_mapping
{
 "properties": {
 "content": {
 "type": "text",
 "analyzer": "my_synonym_analyzer"
 }
 }
}

But the result reports an error:

{
 "error": {
 "root_cause": [
 {
 "type": "mapper_exception",
 "reason": "analyzer [my_synonym_analyzer] contains filters [my_synonym_filter] that are not allowed to run in index time mode."
 }
 ],
 "type": "mapper_parsing_exception",
 "reason": "Failed to parse mapping: analyzer [my_synonym_analyzer] contains filters [my_synonym_filter] that are not allowed to run in index time mode.",
 "caused_by": {
 "type": "mapper_exception",
 "reason": "analyzer [my_synonym_analyzer] contains filters [my_synonym_filter] that are not allowed to run in index time mode."
 }
 },
 "status": 400
}

I study a couple of tutorials but it seems that's a common way to assign the mapping. Any idea what I'm doing wrong?

Thanks, Andre

asked Jul 1, 2025 at 9:59

1 Answer 1

0

This error usually means you're sending a value type (like a string) to a field that’s mapped as an object, or vice versa.

Example:

  • Mapping: "location": { "type": "object" }

  • Data sent: "location": "New York" (should be an object)

How to fix: follow tips below,

  • Either change your mapping to type: keyword if you want a string.

  • Or change your data to an object like: "location": { "city": "New York" }

Please check your mapping with GET index/_mapping and make sure your data matches it.

answered Jul 1, 2025 at 10:17
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you. When I check the mapping it returns text: "content": { "type": "text" },

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.