2

My objective is to be able to search for words with parenthesis around them, for example:

(Andy)

From what I can tell if I do a Mapping Charfilter and change the parenthesis to underscores this will accomplish what I'm after.

    "index" : {
        "analysis" : {
            "char_filter" : {
                "my_mapping" : {
                    "type" : "mapping",
                    "mappings" : ["( => _", ") => _"]
                }
            },
            "analyzer" : {
                "custom_with_char_filter" : {
                    "tokenizer" : "standard",
                    "char_filter" : ["my_mapping"]
                },
            }
        }
    }
}';

When I run the above I get the following error:

{"error":"ElasticSearchParseException[failed to parse source for create index]; nested: JsonParseException[Unexpected character ('}' (code 125)): was expecting either valid name character (for unquoted name) or double-quote (for quoted) to start field name\n at [Source: [B@70de7f1b; line: 15, column: 14]]; ","status":400}

1 Answer 1

4

Carefully reread the error message. It has all the information you need to figure this one out. Basically, you have an extra comma on line 14, so the parser is expecting it to be followed by a name, instead it gets '}' on the line 15, column 14.

Sign up to request clarification or add additional context in comments.

2 Comments

Thank you imotov. Removing the extra comma indeed fixed the error problem. However now I get the error message: "{"error":"IndexAlreadyExistsException[[xenforo113] Already exists]","status":400}". In reading more about what I want to do, I cannot add this mapping to an existing index. I think I need to delete the index, create a new analyzer and re-index.
Yes, you will need to delete the index and re-index.

Your Answer

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.