You are currently browsing legacy 3.0 version of documentation. Click here to switch to the newest 5.1 version.
Commands: Querying: How to work with Suggestion query?
To take advantage of a suggestion feature use the Suggest endpoint.
Syntax
curl \
http://{serverName}/databases/{databaseName}/suggest/{indexName}? \
&term={term} \
&field={field} \
&max={max} \
&popularity={popularity} \
&distance={distance} \
&accuracy={accuracy} \
-X GET
Request
Query parameter
Required
Description
index
Yes
A name of an index to query.
term
Yes
term used to compute suggestions
field
Yes
field used for suggestions
max
No
maximum number of suggestions
popularity
No
sort results by popularity
distance
No
method used for computing distance
accuracy
No
accuracy level
Response
Status code
Description
200
OK
Return Value
Description
Suggestions
array of suggestions
Header
Description
ETag
index etag
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
{ "Suggestions" : [ "john", "jones", "johnson" ] }
Please enable JavaScript to view the comments powered by Disqus.