logo

English

Index Documents



POST /api/v2/projects/{project}/collections/{collection}/documents
Where:
  1. {project} is your project name on Lableb dashboard, e.x wptest.
  2. {collection} is the name of collection of documents you want to search in, e.x posts.

Request body:

When you create a project on Lableb dashboard, your documents will have the following schema by default:
  1. id: a unique identifier for a document.
  2. title: the document title.
  3. content: the document content.
  4. image: document image url.
  5. url: document url on your site.
  6. tags: an array of tags.
  7. category: an array of categories.
  8. author: an array of author names.
  9. date: an ISO-8601 date string.

Example request:

Base URL http://api-bahuth.lableb.com/ POST /api/v2/projects/wptest/collections/posts/documents?token=qxDFI791xxxx-8wmxIBIONYiEK44PGnxxxxxx*
Body:

[
    {    
        "id": 1,
        "title": "Lableb is awesome",
        "content": "example contnet goes here",
        "image": "https://mysite.com/static/images/lableb.png",
        "url": "https://mysite.com/posts/lableb-is-awesome",
        "tags": ["Fast", "Accurate"],
        "category": ["Search", "Cloud"],
        "authors": ["Lableb"],
        "date": "2011-07-01T10:50:23Z"
    }
]

Example response:

{
    "time": 100,
    "code": 200,
    "response": null
}

Update Indexed Documents

To update indexed document, just re-index it with the same ID.