IMPORTANT: No additional bug fixes or documentation updates
will be released for this version. For the latest information, see the
current release documentation.
Configuring built-in analyzers
edit
IMPORTANT: This documentation is no longer updated. Refer to Elastic's version policy and the latest documentation.
Configuring built-in analyzers
editThe built-in analyzers can be used directly without any configuration. Some
of them, however, support configuration options to alter their behaviour. For
instance, the standard analyzer can be configured
to support a list of stop words:
response = client.indices.create(
index: 'my-index-000001',
body: {
settings: {
analysis: {
analyzer: {
std_english: {
type: 'standard',
stopwords: '_english_'
}
}
}
},
mappings: {
properties: {
my_text: {
type: 'text',
analyzer: 'standard',
fields: {
english: {
type: 'text',
analyzer: 'std_english'
}
}
}
}
}
}
)
puts response
response = client.indices.analyze(
index: 'my-index-000001',
body: {
field: 'my_text',
text: 'The old brown cow'
}
)
puts response
response = client.indices.analyze(
index: 'my-index-000001',
body: {
field: 'my_text.english',
text: 'The old brown cow'
}
)
puts response
PUT my-index-000001
{
"settings": {
"analysis": {
"analyzer": {
"std_english": {
"type": "standard",
"stopwords": "_english_"
}
}
}
},
"mappings": {
"properties": {
"my_text": {
"type": "text",
"analyzer": "standard",
"fields": {
"english": {
"type": "text",
"analyzer": "std_english"
}
}
}
}
}
}
POST my-index-000001/_analyze
{
"field": "my_text",
"text": "The old brown cow"
}
POST my-index-000001/_analyze
{
"field": "my_text.english",
"text": "The old brown cow"
}
|
We define the |
|
|
The |
|
|
The |