You are currently browsing legacy 3.0 version of documentation. Click here to switch to the newest 5.0 version.

We can help you with migration to the latest RavenDB

Contact Us Now
see on GitHub

Commands: Querying: How to work with MoreLikeThis query?

To find similar or related documents use the /morelikethis/ endpoint.

Syntax

curl \
	http://{serverName}/databases/{databaseName}/morelikethis/? \
		&index={indexName} \
		&docId={documentId} \
		&fields={field} \
		&boost={boost} \ 
		&boostFactor={boostFactor} \
		&maxQueryTerms={maxQueryTerms} \
		&maxNumTokens={maxNumTokens} \
		&maxWordLen={maxWordLen} \
		&minDocFreq={minDocFreq} \
		&maxDocFreq={maxDocFreq} \
		&maxDocFreqPct={maxDocFreqPct} \
		&minTermFreq={minTermFreq} \
		&minWordLen={minWordLen} \
		&stopWords={stopWords} \
		&resultsTransformer={resultsTransformer} \
		&tp-{param}={value} \
		&include={include} \
	-X GET

Request

Query parameter Required Multiple allowed Description
indexName Yes No A name of an index to query.
documentId Yes No Document id to be used for more like this
fields No Yes Fields used for comparision
boost No No Whether to enable boost
boostFactor No No Boost factor
maxQueryTerms No No Maximum query terms
maxNumTokens No No Maximum number of tokens
maxWordLen No No Maximum word length
minDocFreq No No Minimum document frequency
maxDocFreq No No Maximum document frequency
maxDocFreqPct No No Maximum document frequency (as percentage)
minTermFreq No No Minimum term frequency
minWordLen No No Minimum word length
stopWords No No Name of document which contains stop words
resultsTransformer No No Result transformer to use
{param}={value} No Yes Transformer parameters
include No No Include paths

Response

Status code Description
200 OK
Return Value Description
Results List of requested documents
Includes List of included documents

Example

curl -X GET "http://localhost:8080/databases/NorthWind/suggest/Users/ByFullName?term=johne&field=FullName&max=10&popularity=false&distance=Levenshtein" 
< HTTP/1.1 200 OK
{"Results":[...results ...],"Includes":[]}