Hi,
I work on certification and mapping exercises.
I defined the following index with a custom analyzer.
I wonder :
-
Since the analyzer is defined in settings part, is it used for all fields ? If yes, could some one explain me how to define a such analyzer for content field only
-
I try to define more than one custom char_filter and filter but i did not find how to achieve that, is it possible ?
-
is it possible to define a field which is stored in _source but which is not indexed, is the index attribute available ?
Here is the index definition:
PUT /an_index
{
"settings": {
"analysis": {
"char_filter": {
"mychar": {
"type": "mapping",
"mappings": [
"c++ => cpp",
"C++ => cpp",
"IT => IT"
]
}
},
"filter": {
"myFilter": {
"type": "stop",
"stopwords": [
"can",
"we",
"our",
"you",
"your",
"all"
]
}
},
"analyzer": {
"monanalyzer": {
"type": "custom",
"char_filter": [
"mychar"
],
"tokenizer": "standard",
"filter": [
"lowercase",
"stop",
"myFilter"
]
}
}
}
},
"mappings": {
"_doc": {
"properties": {
"author": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"category": {
"type": "keyword",
"ignore_above": 256
},
"content": {
"type": "text",
"fields": {
"monChamp": {
"type": "text",
"analyzer":"monanalyzer"
}
}
},
"locales": {
"type": "keyword",
"ignore_above": 256
},
"publish_date": {
"type": "date"
},
"title": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"url": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
}
}
}