This documentation contains work-in-progress information for future Elastic Stack and Cloud releases. Use the version selector to view supported release docs. It also contains some Elastic Cloud serverless information. Check out our serverless docs for more details.
Keyword analyzer
editKeyword analyzer
editThe keyword
analyzer is a “noop” analyzer which returns the entire input
string as a single token.
Example output
editresp = client.indices.analyze( analyzer="keyword", text="The 2 QUICK Brown-Foxes jumped over the lazy dog's bone.", ) print(resp)
response = client.indices.analyze( body: { analyzer: 'keyword', text: "The 2 QUICK Brown-Foxes jumped over the lazy dog's bone." } ) puts response
const response = await client.indices.analyze({ analyzer: "keyword", text: "The 2 QUICK Brown-Foxes jumped over the lazy dog's bone.", }); console.log(response);
POST _analyze { "analyzer": "keyword", "text": "The 2 QUICK Brown-Foxes jumped over the lazy dog's bone." }
The above sentence would produce the following single term:
[ The 2 QUICK Brown-Foxes jumped over the lazy dog's bone. ]
Configuration
editThe keyword
analyzer is not configurable.
Definition
editThe keyword
analyzer consists of:
- Tokenizer
If you need to customize the keyword
analyzer then you need to
recreate it as a custom
analyzer and modify it, usually by adding
token filters. Usually, you should prefer the
Keyword type when you want strings that are not split
into tokens, but just in case you need it, this would recreate the
built-in keyword
analyzer and you can use it as a starting point
for further customization:
resp = client.indices.create( index="keyword_example", settings={ "analysis": { "analyzer": { "rebuilt_keyword": { "tokenizer": "keyword", "filter": [] } } } }, ) print(resp)
response = client.indices.create( index: 'keyword_example', body: { settings: { analysis: { analyzer: { rebuilt_keyword: { tokenizer: 'keyword', filter: [] } } } } } ) puts response
const response = await client.indices.create({ index: "keyword_example", settings: { analysis: { analyzer: { rebuilt_keyword: { tokenizer: "keyword", filter: [], }, }, }, }, }); console.log(response);