index-prefixes.asciidoc 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. [[index-prefixes]]
  2. === `index_prefixes`
  3. The `index_prefixes` parameter enables the indexing of term prefixes to speed
  4. up prefix searches. It accepts the following optional settings:
  5. [horizontal]
  6. `min_chars`::
  7. The minimum prefix length to index. Must be greater than 0, and defaults
  8. to 2. The value is inclusive.
  9. `max_chars`::
  10. The maximum prefix length to index. Must be less than 20, and defaults to 5.
  11. The value is inclusive.
  12. This example creates a text field using the default prefix length settings:
  13. [source,console]
  14. --------------------------------
  15. PUT my-index-000001
  16. {
  17. "mappings": {
  18. "properties": {
  19. "body_text": {
  20. "type": "text",
  21. "index_prefixes": { } <1>
  22. }
  23. }
  24. }
  25. }
  26. --------------------------------
  27. <1> An empty settings object will use the default `min_chars` and `max_chars`
  28. settings
  29. This example uses custom prefix length settings:
  30. [source,console]
  31. --------------------------------
  32. PUT my-index-000001
  33. {
  34. "mappings": {
  35. "properties": {
  36. "full_name": {
  37. "type": "text",
  38. "index_prefixes": {
  39. "min_chars" : 1,
  40. "max_chars" : 10
  41. }
  42. }
  43. }
  44. }
  45. }
  46. --------------------------------