forked from jaeksoft/opensearchserver
-
Notifications
You must be signed in to change notification settings - Fork 0
Field set default unique
Emmanuel Keller edited this page Oct 7, 2013
·
5 revisions
Use this API to set the default field and the unique field in the schema
Requirement: OpenSearchServer v1.5
URL: /services/rest/index/{index_name}/field?default={default_field}&unique={unique_field}
Method: POST
Header (optional returned type):
- Accept:
application/jsonorapplication/xml
URL parameters:
- index_name (required): The name of the index.
Query parameters:
- default (optional): The name of the default field. To reset the field, just pass an empty string.
- unique (optional): The name of the default field. To reset the field, pass an empty string.
The default and/or unique field has been updated.
HTTP code: 200
Content (application/json):
{
"successful": true,
"info": "Default field set to 'content'. Unique field set to 'url'."
}The creation/update failed. The reason is provided in the content.
HTTP code: 404
Field not found: my_field
Using CURL:
curl -XPOST http://localhost:8080/services/rest/index/my_index/field?default=content&unique=urlUsing jQuery:
$.ajax({
type: "POST",
dataType: "json",
url: "http://localhost:8080/services/rest/index/my_index/field?default=content&unique=url"
}).done(function (data) {
console.log(data);
});