mlt-field-query.asciidoc 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. [[query-dsl-mlt-field-query]]
  2. === More Like This Field Query
  3. The `more_like_this_field` query is the same as the `more_like_this`
  4. query, except it runs against a single field. It provides nicer query
  5. DSL over the generic `more_like_this` query, and support typed fields
  6. query (automatically wraps typed fields with type filter to match only
  7. on the specific type).
  8. [source,js]
  9. --------------------------------------------------
  10. {
  11. "more_like_this_field" : {
  12. "name.first" : {
  13. "like_text" : "text like this one",
  14. "min_term_freq" : 1,
  15. "max_query_terms" : 12
  16. }
  17. }
  18. }
  19. --------------------------------------------------
  20. `more_like_this_field` can be shortened to `mlt_field`.
  21. The `more_like_this_field` top level parameters include:
  22. [cols="<,<",options="header",]
  23. |=======================================================================
  24. |Parameter |Description
  25. |`like_text` |The text to find documents like it, *required*.
  26. |`percent_terms_to_match` |The percentage of terms to match on (float
  27. value). Defaults to `0.3` (30 percent).
  28. |`min_term_freq` |The frequency below which terms will be ignored in the
  29. source doc. The default frequency is `2`.
  30. |`max_query_terms` |The maximum number of query terms that will be
  31. included in any generated query. Defaults to `25`.
  32. |`stop_words` |An array of stop words. Any word in this set is
  33. considered "uninteresting" and ignored. Even if your Analyzer allows
  34. stopwords, you might want to tell the MoreLikeThis code to ignore them,
  35. as for the purposes of document similarity it seems reasonable to assume
  36. that "a stop word is never interesting".
  37. |`min_doc_freq` |The frequency at which words will be ignored which do
  38. not occur in at least this many docs. Defaults to `5`.
  39. |`max_doc_freq` |The maximum frequency in which words may still appear.
  40. Words that appear in more than this many docs will be ignored. Defaults
  41. to unbounded.
  42. |`min_word_length` |The minimum word length below which words will be
  43. ignored. Defaults to `0`. (Old name "min_word_len" is deprecated)
  44. |`max_word_length` |The maximum word length above which words will be
  45. ignored. Defaults to unbounded (`0`). (Old name "max_word_len" is deprecated)
  46. |`boost_terms` |Sets the boost factor to use when boosting terms.
  47. Defaults to deactivated (`0`). Any other value activates boosting with given
  48. boost factor.
  49. |`boost` |Sets the boost value of the query. Defaults to `1.0`.
  50. |`analyzer` |The analyzer that will be used to analyze the text.
  51. Defaults to the analyzer associated with the field.
  52. |=======================================================================