Basic Usage

Finds documents similar to a given document or set of field values. This is useful for recommendation engines or finding related content based on textual similarities.

You must pass either:

  • document_id, which takes a key_field value to match against the corresponding document.
  • document_fields, which takes a JSON object string to match against.

All other parameters are compatible with both document_id and document_fields.

document_id

The ID of the document to find similar documents to.

document_fields

A JSON object representing the field values to use for similarity matching.

min_doc_frequency

Minimum document frequency of terms to be considered.

max_doc_frequency

Maximum document frequency of terms to be considered.

min_term_frequency

Minimum term frequency of terms to be considered.

max_query_terms

Maximum number of query terms to be used.

min_word_length

Minimum word length of terms to be considered.

max_word_length

Maximum word length of terms to be considered.

boost_factor

Boost factor to amplify the impact of matching terms.

stop_words

A JSON array of stop words to be ignored in the query.