How I create my first Index in ElasticSearch using Kibana?

I am not able to create the Index in elastic-search using Kibana. Below is my requirement compare to RDBMS -

RDBMD - Details

DB Name : "SolutionHub"
Table 1 : "Employee.Employee"

{
    EMP_ID      : INT
    EMP_NM      : NVARCHAR(150)
    EMP_FST_NM  : NVARCHAR(50)
    EMP_lST_NM  : NVARCHAR(50)
}

Table 2 : "Employee.Address"

{
    ADR_ID      : INT
    EMP_ID      : INT
    ADR_TYP     : INT
    ADR_LINE_1  : NVARCHAR(100)
    ADR_LINE_2  : NVARCHAR(100)
    ADR_LINE_3  : NVARCHAR(100)
    ADR_CNTRY   : INT
    ADR_STATE   : INT
    ADR_CITY    : INT
    ADR_ZIP_CD  : NVARCHAR(100)
}

Employee can have multiple address based on address type. Can anyone help me to prepare the curl statements for Kibana.

Thanks
Gaurav Singh

Hello Gaurav,

I would create the following index template for this:

POST _template/solution-hub-template
{
    "order" : 9999,
    "index_patterns" : [
      "solution-hub-*"
    ],
    "settings" : {
      "index" : {
        "number_of_shards" : "2"
      }
    },
    "mappings" : {
      "doc" : {
        "_source" : {
          "enabled" : true
        },
        "properties" : {
          "Employee" : {
            "properties" : {
              "EMP_ID" : {
                "type" : "long"
              },
              "EMP_NM" : {
                "type" : "keyword"
              },
              "EMP_FST_NM" : {
                "type" : "keyword"
              },
              "EMP_lST_NM" : {
                "type" : "keyword"
              },
              "EMP_ADR" : {
                "properties" : {
                  "ADR_ID" : {
                    "type" : "long"
                  },
                  "ADR_TYP" : {
                    "type" : "long"
                  },
                  "ADR_LINE_1" : {
                    "type" : "text"
                  },
                  "ADR_LINE_2" : {
                    "type" : "text"
                  },
                  "ADR_LINE_3" : {
                    "type" : "text"
                  },
                  "ADR_CNTRY" : {
                    "type" : "long"
                  },
                  "ADR_STATE" : {
                    "type" : "long"
                  },
                  "ADR_CITY" : {
                    "type" : "long"
                  },
                  "ADR_ZIP_CD" : {
                    "type" : "keyword"
                  }
                }
              }
            }
          }
        }
      }
    },
    "aliases" : { }
  }

This way, address and employee are stored in the same index so I removed field EMP_ID from the address.

EMP_ADR does not need to be defined as array as arrays are supported out of the box: Array Type | Elasticsearch Guide [1.4] | Elastic

Best regards
Wolfram

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.