forked from jaeksoft/opensearchserver
-
Notifications
You must be signed in to change notification settings - Fork 0
Index create
AlexandreToyer edited this page Sep 30, 2013
·
9 revisions
This API creates a new index
Requirement: OpenSearchServer v1.5
URL: /services/rest/index/{index_name}/template/{template_name}
Method: POST
Header (returned type):
- Accept:
application/json - Accept:
application/xml
URL parameters:
- index_name (required): The name of the index
-
template_name (optional): The name of the template
- EMPTY_INDEX
- WEB_CRAWLER
- FILE_CRAWLER
The index has been created.
HTTP code: 200
Content (application/json):
{
result: {
@successful: "true",
info: "Created Index my_index"
}
}The index creation failed. The reason is provided in the content.
HTTP code: 500
Content (text/plain):
directory my_index already exists
Using CURL:
curl -XPOST http://localhost:8080/services/rest/index/my_index/template/WEB_CRAWLERUsing jQuery:
$.ajax({
type: "POST",
dataType: "json",
url: "http://localhost:8080/services/rest/index/my_index/template/WEB_CRAWLER"
}).done(function (data) {
console.log(data);
});