index-prefixes.asciidoc 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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,js]
  14. --------------------------------
  15. PUT my_index
  16. {
  17. "mappings": {
  18. "properties": {
  19. "body_text": {
  20. "type": "text",
  21. "index_prefixes": { } <1>
  22. }
  23. }
  24. }
  25. }
  26. --------------------------------
  27. // CONSOLE
  28. <1> An empty settings object will use the default `min_chars` and `max_chars`
  29. settings
  30. This example uses custom prefix length settings:
  31. [source,js]
  32. --------------------------------
  33. PUT my_index
  34. {
  35. "mappings": {
  36. "properties": {
  37. "full_name": {
  38. "type": "text",
  39. "index_prefixes": {
  40. "min_chars" : 1,
  41. "max_chars" : 10
  42. }
  43. }
  44. }
  45. }
  46. }
  47. --------------------------------
  48. // CONSOLE