logo

English

Index Documents



POST /api/v1/{project}/collections/{collection}/documents
Where:
  1. {project} is your project name, 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_t_bi: the document title.
  3. content_t_bi: the document content.
  4. image_s: document image url.
  5. url_s: document url on your site.
  6. tags_sa: an array of tags.
  7. category_sa: an array of categories.
  8. author_sa: an array of author names.
  9. date_dt: an ISO-8601 date string.

Example request:

POST /api/v1/wptest/collections/posts/documents?token=qxDFI791xxxx-8wmxIBIONYiEK44PGnxxxxxx
Body:

[
    {    
        "id": 1,
        "title_t_bi": "Lableb is awesome",
        "content_t_bi": "example contnet goes here",
        "image_s": "https://mysite.com/static/images/lableb.png",
        "url_s": "https://mysite.com/posts/lableb-is-awesome",
        "tags_sa": ["Fast", "Accurate"],
        "category_sa": ["Search", "Cloud"],
        "authors_sa": ["Lableb"],
        "date_dt": "2011-07-01T10:50:23Z"
    }
]

Example response:

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

Update Indexed Documents

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