# Insert a new json-record into an indexed document

**URL:** https://discuss.elastic.co/t/insert-a-new-json-record-into-an-indexed-document/360683
**Category:** Elasticsearch
**Created:** [June 3, 2024, 2:20am UTC](https://discuss.elastic.co/t/insert-a-new-json-record-into-an-indexed-document/360683 "2024-06-03T02:20:24Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Noureddine\_Ettalhi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/noureddine_ettalhi/32/134984_2.png) [@Noureddine\_Ettalhi](https://discuss.elastic.co/u/Noureddine_Ettalhi)
#### Post date: [June 3, 2024, 2:20am UTC](https://discuss.elastic.co/t/insert-a-new-json-record-into-an-indexed-document/360683/1 "2024-06-03T02:20:24Z")

</div>

I am new to Elasticsearch, and I am trying to find a way to have an analogy with Oracle / SQL culture :

1. Create table.
2. insert records.
3. update a record.
4. select a record  
...etc

my current example is so simple:

```auto
PUT /ettalhi-explicit-idx
{
  "mappings": {
    "properties": {
      "ettalhi-fld-age": { "type": "integer" },  
      "ettalhi-fld-email": { "type": "keyword" }, 
      "ettalhi-fld-name": { "type": "text" }     
    }
  }
}

GET ettalhi-explicit-idx/_mapping/

PUT /ettalhi-explicit-idx/_mapping
{
  "properties": {
    "ettalhi-fld-employee-id": {
      "type": "keyword",
      "index": false
    }
  }
}

GET /ettalhi-explicit-idx/_mapping/field/ettalhi-fld-employee-id

POST /ettalhi-explicit-idx/_doc/2
{
  "ettalhi-fld-age": "48",
  "ettalhi-fld-email": "ettalhi02@gmail.com",
  "ettalhi-fld-name": "Noureddine Ettalhi 04",
  "ettalhi-fld-employee-id": "s6486679"
}

GET /ettalhi-explicit-idx/_doc/2

Result of the last request is =
{
  "_index": "ettalhi-explicit-idx",
  "_id": "2",
  "_version": 4,
  "_seq_no": 4,
  "_primary_term": 1,
  "found": true,
  "_source": {
    "ettalhi-fld-age": "48",
    "ettalhi-fld-email": "ettalhi02@gmail.com",
    "ettalhi-fld-name": "Noureddine Ettalhi 04",
    "ettalhi-fld-employee-id": "s6486679"
  }
}

```

The question is :  
How can I add a new line (record) to the doc(2) ?

What is wrong in this question ?

Thanks

---

<div class="post-metadata">

### Author: ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)
#### Post date: [June 3, 2024, 5:04am UTC](https://discuss.elastic.co/t/insert-a-new-json-record-into-an-indexed-document/360683/2 "2024-06-03T05:04:41Z")

</div>

Elasticsearch is not a relational system so analogies to RDBMS only work to some extent. Think of an index as a table and the mappings as column definitions. Each document is a row in the table.

Note that Elasticsearch does not support joins, so keep this in mind when you model your data.

> [@Noureddine\_Ettalhi](#):
>
> How can I add a new line (record) to the doc(2) ?

It is not clear what you are looking to achieve. Are you looking to add a new field to a document? If so, use the [update API](https://www.elastic.co/guide/en/elasticsearch/reference/8.13/docs-update.html). Are you looking to add a new document to the index? If so use the [index API](https://www.elastic.co/guide/en/elasticsearch/reference/8.13/docs-index_.html).
