Welcome to getting guide and tutorial

Prerequisites

Before you start this tutorial, complete the following tasks.

Create a new index

To indexing you document you need an index.

1. Go to Search > Indices

undefined

2. Click "Add index" button on the top

3. "Create new index" dialog will appear, Type your index id and index name then click "Ok" to create new index.

Index Id

Is system unique id. limit 10 character, i.e. myindex

Index name

Is your index name or title, use to extend meaning of index id, i.e. My Index.

undefined

4. Now your new index is create, click on "Settings" button to view the index.

Create key for an index

Now your index id "myindex" is create but not ready to create new document, to get ready you need to create a Key for your index.

Index Key

Is your token use to create document via REST API.

undefined

1. Click on Keys section to expand

undefined

2. Now your key is blank, click on "Regenerate key" button.

undefined

3. On "Regenerate key" dialog select primary key and type the expire day, for this example is 99 days that mean this key will valid for 99 days.

Create new fields

Field

A document contains a list of fields, or key-value pairs. The value can be a simple (scalar) value (eg a string, integer, date). A field is similar to a column in a table in a relational database. The mapping for each field has a field type which indicates the type of data that can be stored in that field, eg integer, string, object. The field also allows you to define (amongst other things) how the value for a field should be analyzed.

In this tutorial we will create 4 new fields.

undefined

1. Click on Add field button

Add following field name and data type

Field Name Data Type Support Highlight Support Facet Text Analyzer
description Text Yes No Default
type Keyword No Yes
thumbnailurl Keyword No No
fulltext Full-Text Yes No Default
Field Name Data Type Support Highlight Support Facet Text Analyzer
description Text Yes No Default
type Keyword No Yes
thumbnailurl Keyword No No
fulltext Full-Text Yes No Default

undefined

2. Verify all new fields is created and show as image above.

Indexing document

In this tutorial we will guide you to create document via REST API, to get started indexing you need following keys.

  • Index url
  • Index key

1. To get those key simply go to your index

2. Get your keys as image showing below

undefined

3. In this tutorial we will create a document with following sample

curl --request POST\
--url '[yourindexurl]'\
--header 'accept: application/json'\
--header 'content-type: application/json'\
--header 'authorization: Bearer [yourindexkey]'\
--data '{"id":"1","title":"Hello world", "description":"Designed for the enterprise, DIMDATA securely connects and unifies information from across your on-premises and cloud systems.", "type":"General", "fulltext":"Designed for the enterprise, DIMDATA securely connects and unifies information from across your on-premises and cloud systems."}'\

4. Copy the code above and import to Postman. change [yourindexurl] and [yourindexkey] then send request.

Now you have learn to create new index and create a new document!

Next: deploy your first search portal

More Sample RestAPI

Sample RestAPI to index url with html parser

curl --request POST\
--url '[yourindexurl]?htmlparser=true'\
--header 'accept: application/json'\
--header 'content-type: application/json'\
--header 'authorization: Bearer [yourindexkey]'\
--data '{"id":"https://www.dimdata.com/docs","url":"https://www.dimdata.com/docs","title":"Getting overview what is DIMDATA Platform","type":"Docs","site":"dimdata.com"}'\

Sample RestAPI to OCR and index fulltext

curl --request POST\
--url '[yourindexurl]?ocr=true'\
--header 'accept: application/json'\
--header 'content-type: application/json'\
--header 'authorization: Bearer [yourindexkey]'\
--data '{"id":"doc123","imageurl":"[imageurl]","title":"Contract Paper 2003-2","type":"OCR Docs"}'\

Sample RestAPI to index document with user roles

curl --request POST\
--url '[yourindexurl]'\
--header 'accept: application/json'\
--header 'content-type: application/json'\
--header 'authorization: Bearer [yourindexkey]'\
--data '{"id":"roletest","title":"This is for admin and manager only","role":["admin","manager"]}'\

Sample RestAPI to index with location (Geospatial data)

curl --request POST\
--url '[yourindexurl]'\
--header 'accept: application/json'\
--header 'content-type: application/json'\
--header 'authorization: Bearer [yourindexkey]'\
--data '{"id":"locationtest","title":"My Office location","location" : {"lat" : 40.730610,"lon" : -73.935242}}'\

Notice something is incorrect or outdated?

First off, great eye! We appreciate your discovery and want to ensure it gets addressed immediately. Please let us know here.