Skip to content

Commit

Permalink
[DOCS] Reformat apostrophe token filter docs (elastic#48076)
Browse files Browse the repository at this point in the history
  • Loading branch information
jrodewig committed Oct 16, 2019
1 parent f501a4b commit 8677653
Showing 1 changed file with 89 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,91 @@
[[analysis-apostrophe-tokenfilter]]
=== Apostrophe Token Filter
=== Apostrophe token filter
++++
<titleabbrev>Apostrophe</titleabbrev>
++++

The `apostrophe` token filter strips all characters after an apostrophe,
including the apostrophe itself.
Strips all characters after an apostrophe, including the apostrophe itself.

This filter is included in {es}'s built-in <<turkish-analyzer,Turkish language
analyzer>>. It uses Lucene's
https://lucene.apache.org/core/4_8_0/analyzers-common/org/apache/lucene/analysis/tr/ApostropheFilter.html[ApostropheFilter],
which was built for the Turkish language.


[[analysis-apostrophe-tokenfilter-analyze-ex]]
==== Example

The following <<indices-analyze,analyze API>> request demonstrates how the
apostrophe token filter works.

[source,console]
--------------------------------------------------
GET /_analyze
{
"tokenizer" : "standard",
"filter" : ["apostrophe"],
"text" : "Istanbul'a veya Istanbul'dan"
}
--------------------------------------------------

The filter produces the following tokens:

[source,text]
--------------------------------------------------
[ Istanbul, veya, Istanbul ]
--------------------------------------------------

/////////////////////
[source,console-result]
--------------------------------------------------
{
"tokens" : [
{
"token" : "Istanbul",
"start_offset" : 0,
"end_offset" : 10,
"type" : "<ALPHANUM>",
"position" : 0
},
{
"token" : "veya",
"start_offset" : 11,
"end_offset" : 15,
"type" : "<ALPHANUM>",
"position" : 1
},
{
"token" : "Istanbul",
"start_offset" : 16,
"end_offset" : 28,
"type" : "<ALPHANUM>",
"position" : 2
}
]
}
--------------------------------------------------
/////////////////////

[[analysis-apostrophe-tokenfilter-analyzer-ex]]
==== Add to an analyzer

The following <<indices-create-index,create index API>> request uses the
apostrophe token filter to configure a new
<<analysis-custom-analyzer,custom analyzer>>.

[source,console]
--------------------------------------------------
PUT /apostrophe_example
{
"settings" : {
"analysis" : {
"analyzer" : {
"standard_apostrophe" : {
"tokenizer" : "standard",
"filter" : ["apostrophe"]
}
}
}
}
}
--------------------------------------------------

0 comments on commit 8677653

Please sign in to comment.