forked from jaeksoft/opensearchserver
-
Notifications
You must be signed in to change notification settings - Fork 0
Auto completion: create, update
AlexandreToyer edited this page Sep 30, 2013
·
8 revisions
Use this API to update or create an autocompletion item
Requirement: OpenSearchServer v1.5
URL: /services/rest/index/{index_name}/autocompletion/{autocompletion_name}?field={field_name}&rows={rows}
Method: PUT
Header:
-
Accept (optional returned type):
application/jsonorapplication/xml
URL parameters:
- index_name (required): The name of the index.
- autocompletion_name (required): The name of the auto-completion item.
Query parameters:
- field (required, one or more): The fields providing the terms populating the auto-completion index.
- rows (optional): The number of terms returned by default by the auto-completion query.
The auto-completion item has been created or updated.
HTTP code: 200
Content (application/json):
{
"successful": true,
"info": "Autocompletion item my_expressions updated."
}{
"successful": true,
"info": "Autocompletion item my_expressions inserted"
}The creation/update failed. The reason is provided in the content.
HTTP code: 500
Using CURL:
curl -XPUT http://localhost:8080/services/rest/index/my_index/autocompletion/my_expressions?field=titleExact&field=contentExact&rows=8Using jQuery:
$.ajax({
type: "PUT",
dataType: "json",
url: "http://localhost:8080/services/rest/index/my_index/autocompletion/my_expressions?field=titleExact&field=contentExact&rows=8"
}).done(function (data) {
console.log(data);
});