Apostrophe token filter
Apostrophe token filter
Strips all characters after an apostrophe, including the apostrophe itself.
This filter is included in Elasticsearch’s built-in Turkish language analyzer. It uses Lucene’s ApostropheFilter, which was built for the Turkish language.
Example
The following analyze API request demonstrates how the apostrophe token filter works.
resp = client.indices.analyze(
tokenizer="standard",
filter=[
"apostrophe"
],
text="Istanbul'a veya Istanbul'dan",
)
print(resp)
response = client.indices.analyze(
body: {
tokenizer: 'standard',
filter: [
'apostrophe'
],
text: "Istanbul'a veya Istanbul'dan"
}
)
puts response
const response = await client.indices.analyze({
tokenizer: "standard",
filter: ["apostrophe"],
text: "Istanbul'a veya Istanbul'dan",
});
console.log(response);
GET /_analyze
{
"tokenizer" : "standard",
"filter" : ["apostrophe"],
"text" : "Istanbul'a veya Istanbul'dan"
}
The filter produces the following tokens:
[ Istanbul, veya, Istanbul ]
Add to an analyzer
The following create index API request uses the apostrophe token filter to configure a new custom analyzer.
resp = client.indices.create(
index="apostrophe_example",
settings={
"analysis": {
"analyzer": {
"standard_apostrophe": {
"tokenizer": "standard",
"filter": [
"apostrophe"
]
}
}
}
},
)
print(resp)
response = client.indices.create(
index: 'apostrophe_example',
body: {
settings: {
analysis: {
analyzer: {
standard_apostrophe: {
tokenizer: 'standard',
filter: [
'apostrophe'
]
}
}
}
}
}
)
puts response
const response = await client.indices.create({
index: "apostrophe_example",
settings: {
analysis: {
analyzer: {
standard_apostrophe: {
tokenizer: "standard",
filter: ["apostrophe"],
},
},
},
},
});
console.log(response);
PUT /apostrophe_example
{
"settings": {
"analysis": {
"analyzer": {
"standard_apostrophe": {
"tokenizer": "standard",
"filter": [ "apostrophe" ]
}
}
}
}
}
当前内容版权归 elasticsearch 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 elasticsearch .