suggest.asciidoc 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. [[breaking_50_suggester]]
  2. === Suggester changes
  3. The completion suggester has undergone a complete rewrite. This means that the
  4. syntax and data structure for fields of type `completion` have changed, as
  5. have the syntax and response of completion suggester requests. See
  6. <<search-suggesters-completion,completion suggester>> for details.
  7. For indices created before Elasticsearch 5.0.0, `completion` fields and the
  8. completion suggester will continue to work as they did in Elasticsearch 2.x.
  9. However, it is not possible to run a completion suggester query across indices
  10. created in 2.x and indices created in 5.x.
  11. It is strongly recommended to reindex indices containing 2.x `completion`
  12. fields in 5.x to take advantage of the new features listed below.
  13. NOTE: You will need to change the structure of the completion field values
  14. when reindexing.
  15. ==== Completion suggester is near-real time
  16. Previously, deleted suggestions could be included in results even
  17. after refreshing an index. Now, deletions are visible in near-real
  18. time, i.e. as soon as the index has been refreshed. This applies
  19. to suggestion entries for both context and completion suggesters.
  20. ==== Completion suggester is document-oriented
  21. Suggestions are aware of the document they belong to. Now, associated
  22. documents (`_source`) are returned as part of `completion` suggestions.
  23. IMPORTANT: `_source` meta-field must be enabled, which is the default behavior,
  24. to enable returning `_source` with suggestions.
  25. Previously, `context` and `completion` suggesters supported an index-time
  26. `payloads` option, which was used to store and return metadata with suggestions.
  27. Now metadata can be stored as part of the the same document as the
  28. suggestion for retrieval at query-time. The support for index-time `payloads`
  29. has been removed to avoid bloating the in-memory index with suggestion metadata.
  30. ==== Simpler completion indexing
  31. As suggestions are document-oriented, suggestion metadata (e.g. `output`)
  32. should now be specified as a field in the document. The support for specifying
  33. `output` when indexing suggestion entries has been removed. Now suggestion
  34. result entry's `text` is always the un-analyzed value of the suggestion's
  35. `input` (same as not specifying `output` while indexing suggestions in pre-5.0
  36. indices).
  37. ==== Completion mapping with multiple contexts
  38. The `context` option in `completion` field mapping is now an array to support
  39. multiple named contexts per completion field. Note that this is sugar for
  40. indexing same suggestions under different name with different contexts.
  41. The `default` option for a named `context` has been removed. Now querying with
  42. no `context` against a context-enabled completion field yields results from all
  43. indexed suggestions. Note that performance for match-all-context query
  44. degrades with the number of unique context value for a given `completion` field.
  45. ==== Completion suggestion with multiple context filtering
  46. Previously `context` option in a suggest request was used for filtering suggestions
  47. by `context` value. Now, the option has been named to `contexts` to specify
  48. multiple named context filters. Note that this is not supported by pre-5.0 indices.
  49. Following is the `contexts` snippet for a suggest query filtered by both 'color'
  50. and 'location' contexts:
  51. [source,sh]
  52. ---------------
  53. "contexts": {
  54. "color": [ {...} ],
  55. "location": [ {...} ]
  56. }
  57. ---------------