more-like-this.asciidoc 1.3 KB

1234567891011121314151617181920212223242526272829303132
  1. [[search-more-like-this]]
  2. == More Like This API
  3. The more like this (mlt) API allows to get documents that are "like" a
  4. specified document. Here is an example:
  5. [source,js]
  6. --------------------------------------------------
  7. $ curl -XGET 'http://localhost:9200/twitter/tweet/1/_mlt?mlt_fields=tag,content&min_doc_freq=1'
  8. --------------------------------------------------
  9. The API simply results in executing a search request with
  10. <<query-dsl-mlt-query,moreLikeThis>> query (http
  11. parameters match the parameters to the `more_like_this` query). This
  12. means that the body of the request can optionally include all the
  13. request body options in the <<search-search,search
  14. API>> (aggs, from/to and so on). Internally, the more like this
  15. API is equivalent to performing a boolean query of `more_like_this_field`
  16. queries, with one query per specified `mlt_fields`.
  17. Rest parameters relating to search are also allowed, including
  18. `search_type`, `search_indices`, `search_types`, `search_scroll`,
  19. `search_size` and `search_from`.
  20. When no `mlt_fields` are specified, all the fields of the document will
  21. be used in the `more_like_this` query generated.
  22. By default, the queried document is excluded from the response (`include`
  23. set to false).
  24. Note: In order to use the `mlt` feature a `mlt_field` needs to be either
  25. be `stored`, store `term_vector` or `source` needs to be enabled.