IMPORTANT: No additional bug fixes or documentation updates
will be released for this version. For the latest information, see the
current release documentation.
index_prefixes
editindex_prefixes
editThe index_prefixes
parameter enables the indexing of term prefixes to speed
up prefix searches. It accepts the following optional settings:
|
The minimum prefix length to index. Must be greater than 0, and defaults to 2. The value is inclusive. |
|
The maximum prefix length to index. Must be less than 20, and defaults to 5. The value is inclusive. |
This example creates a text field using the default prefix length settings:
response = client.indices.create( index: 'my-index-000001', body: { mappings: { properties: { body_text: { type: 'text', index_prefixes: {} } } } } ) puts response
PUT my-index-000001 { "mappings": { "properties": { "body_text": { "type": "text", "index_prefixes": { } } } } }
This example uses custom prefix length settings:
response = client.indices.create( index: 'my-index-000001', body: { mappings: { properties: { full_name: { type: 'text', index_prefixes: { min_chars: 1, max_chars: 10 } } } } } ) puts response
PUT my-index-000001 { "mappings": { "properties": { "full_name": { "type": "text", "index_prefixes": { "min_chars" : 1, "max_chars" : 10 } } } } }