API Reference
Create an index
POST /index
Parameters (json):
- name [string,required] - name of the index.
- stemmer [string,optional] - stemmer dictionary. Default is “english”.
- stopwords [string,optional] - stopwords dictionary. Default is “english”.
Request example:
{
"name": "foobar",
"stemmer": "russian",
"stopwords": "_russian_"
}
Response example:
{
"status": true
}
Delete an index
DELETE /index
Parameters (json):
- name [string,required] - name of the index.
Request example:
{
"name": "foobar"
}
Response example:
{
"status": true
}
Create a document
POST /document
Request parameters (json):
- index [string,required] - name of the index.
- code [string,required] - unique identity of inserted content.
- title [string,optional] - title of document.
- text [string,required] - text of document.
Request example:
{
"index": "foobar",
"code": "1",
"title": "Hello",
"text": "World"
}
Response example:
{
"status": true
}
Create multiple documents at once
POST /documents
Request parameters (json):
- index [string,required] - name of the index.
- documents [array,required] - array of documents to save.
- documents.code [string,required] - unique identity of inserted content.
- documents.title [string,optional] - title of document.
- documents.text [string,required] - text of document.
Request example:
{
"index": "foobar",
"documents": [
{
"code": "1",
"title": "Hello",
"text": "World"
}
]
}
Response example:
{
"status": true
}
Delete a document
DELETE /document
Request parameters (json or URL):
- index [string,required] - index of elasticsearch.
- code [string,required] - unique identity of inserted content.
Request example:
{
"index": "foobar",
"code": "1"
}
Response example:
{
"status": true
}
Search documents
GET /documents
Request parameters (json):
- index [string,required] - index of elasticsearch.
- search [string,required] - search string in title or text.
- from [string,optional] - offset of returned results set. Default is 0.
- size [string,optional] - size of returned results set. Default is 50.
Request example:
{
"index": "foobar",
"search": "lorem ipsum"
}
Response parameters (json):
- code [string] - unique identity of inserted content.
- title [string] - title of document.
- text [string] - text of document.
Response example:
{
"status": true,
"content": {
"documents": [
{
"code": "1",
"title": "Hello",
"text": "World"
}
]
}
}