# Elastic Schema for frequently update

**URL:** https://discuss.elastic.co/t/elastic-schema-for-frequently-update/120052
**Category:** Elasticsearch
**Created:** [February 15, 2018, 6:24pm UTC](https://discuss.elastic.co/t/elastic-schema-for-frequently-update/120052 "2018-02-15T18:24:07Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![smoqadam](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/smoqadam/32/27794_2.png) [@smoqadam](https://discuss.elastic.co/u/smoqadam)
#### Post date: [February 15, 2018, 6:24pm UTC](https://discuss.elastic.co/t/elastic-schema-for-frequently-update/120052/1 "2018-02-15T18:24:07Z")

</div>

I'm new to elastic and need to know what is the best schema design for an index that need to update frequently. My schema is like this:

```
 {
    "_index" : "test_index",
    "_type" : "test_type",
    "_id" : "10000",
    "_score" : 1.0,
    "_source" : {
      "user_id" : 12,
      "index_date" : {
        "date" : "2018-02-06 14:25:49.816952",
        "timezone_type" : 3,
        "timezone" : "UTC"
      },
      "rating" : null,
      "orders" : [          
        {
          "hour" : "08",
          "v_id":100,
          "count" : 1
        },
        {
          "hour" : "10",
          "v_id":100,
          "count" : 1
        }
      ],
      "products" : [
        {
          "p_id" : 970111,
          "count" : 4
        },
        {
          "p_id" : 1280811,
          "count" : 1
        },

      ]
    }
  },

```

but if I want to update `count` in `orders` array I have two options:

## 1. find the index, update, reindex

- I have to find the index
- then update count in my programming language(PHP)
- then reindex the whole object

## 2. change the schema

I think the first solution is not the proper way to work with elastic(in this case) and I believe my schema need to change if I want to update `count`s.

Now I have two questions,

1. what is the problem with the first solution?
2. how can I change the schema if I want to update `count`s in `orders` and `products` array?

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [March 15, 2018, 6:25pm UTC](https://discuss.elastic.co/t/elastic-schema-for-frequently-update/120052/2 "2018-03-15T18:25:19Z")

</div>

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