Reputation: 5425
Sample document in elasticsearch:
{
"name": "Tom",
"hobbies": [
{
"hobby": "go for a walk"
},
{
"hobby": "board games"
}
]
}
Here is mapping added for "name":
{
"person": {
"_all": {
"analyzer": "ik_max_word",
"search_analyzer": "ik_max_word",
"term_vector": "no",
"store": "false"
},
"properties": {
"name": {
"type": "string",
"store": "no",
"term_vector": "with_positions_offsets",
"analyzer": "ik_max_word",
"search_analyzer": "ik_max_word",
"include_in_all": "true",
"boost": 8
}
}
}
}
Problem: How do I add mapping for hobbies.hobby? I want to specify this field for analyzer -> ik_max_word
Upvotes: 0
Views: 2157
Reputation: 5425
Okay, according to Object datatype description, it should be done like this:
{
"person": {
"_all": {
"analyzer": "ik_max_word",
"search_analyzer": "ik_max_word",
"term_vector": "no",
"store": "false"
},
"properties": {
"name": {
"type": "string",
"store": "no",
"term_vector": "with_positions_offsets",
"analyzer": "ik_max_word",
"search_analyzer": "ik_max_word",
"include_in_all": "true",
"boost": 8
},
"hobbies": {
"properties": {
"hobby": {
"type": "string",
"store": "no",
"term_vector": "with_positions_offsets",
"analyzer": "ik_max_word",
"search_analyzer": "ik_max_word",
"include_in_all": "true",
"boost": 8
}
}
}
}
}
}
Upvotes: 1