0

I have an elastic search object in which one field is an array type. now i want to apply a different analyser than standard default one. when i pass analyzer in index definition, it is throwing error. how can i do this?

In the below example, skills contains an array of values. all i want is to apply different analysers and see results. how can i achieve that?

 "skills": { "type": "object", "analyzer": "simple" }, "profile": { "type": "text", "analyzer": "simple" }, "job_title": { "type": "text", "analyzer": "simple" }, 

Getting below error:

{ "error": { "root_cause": [ { "type": "mapper_parsing_exception", "reason": "Mapping definition for [skills] has unsupported parameters: [analyzer : simple]" } ], "type": "mapper_parsing_exception", "reason": "Failed to parse mapping [_doc]: Mapping definition for [skills] has unsupported parameters: [analyzer : simple]", "caused_by": { "type": "mapper_parsing_exception", "reason": "Mapping definition for [skills] has unsupported parameters: [analyzer : simple]" } }, "status": 400 } 
5
  • It would help to see the error you're getting and the different commands you're running Commented Jul 28, 2020 at 13:39
  • updated error message in question Commented Jul 28, 2020 at 13:46
  • You can only define and analyzer for text fields, not object ones Commented Jul 28, 2020 at 13:47
  • how can i solve this problem? Commented Jul 28, 2020 at 13:51
  • Can you show a sample document that you want to search? Commented Jul 28, 2020 at 13:56

1 Answer 1

0

There's no dedicated array data type in ES. If skills is an array of keywords, you can use type:text & analyzer:simple.

Tip: if you'd like to quickly iterate on the effects of different analyzers, you can use the _analyze endpoint without having to drop/adjust/reindex each time:

GET _analyze { "text": [ "lorem", "ipsum", "123abc" ], "analyzer": "simple" } 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.