# NEST Client - Mapping, aggregations, search for dynamic properties/attributes of a model

**URL:** <https://discuss.elastic.co/t/nest-client-mapping-aggregations-search-for-dynamic-properties-attributes-of-a-model/264544>\
**Category:** Elasticsearch\
**Created:** [February 17, 2021, 9:44am UTC](https://discuss.elastic.co/t/nest-client-mapping-aggregations-search-for-dynamic-properties-attributes-of-a-model/264544 "2021-02-17T09:44:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![krishnapss](https://avatars.discourse-cdn.com/v4/letter/k/43a26b/32.png) [@krishnapss](https://discuss.elastic.co/u/krishnapss)\
**Post date:** [February 17, 2021, 9:44am UTC](https://discuss.elastic.co/t/nest-client-mapping-aggregations-search-for-dynamic-properties-attributes-of-a-model/264544/1 "2021-02-17T09:44:34Z")

</div>

Hi,  
Could someone please help me to solve this problem.

We are trying to integrate elasticsearch in our project using NEST Client.

For our project we will have different schema per customer or product.

e.g. cars, books, drinks, clothes, gifts etc

In all scenarios data can be millions and updates frequently.

How can we create mapping when the

**model has some fixed and many dynamic properties (or attributes). Some props are nested and nested objects have some fixed and some dynamic properties ?**

And also we need to do aggregations, search etc on the web application.

Can we solve this problem? Is NEST client or REST api is better to solve this problem?  
e.g. Model 1

```auto
{
  "id": 1,
  "productid": "123",
  "description": "BMW 1 Series",
  "division": {
    "value": "UK",
    "description": "United Kingdom"
  },
  "vehicletype": {
    "value": "Car",
    "description": "Car"
  },
  "bodystyle": {
    "value": "HATCHBACK",
    "description": "Hatchback"
  },
  "mileage": {
    "value": "10000",
    "description": "10,000 miles"
  },
  "price": {
    "value": "8991",
    "description": "£8,991.00 cash price"
  },
  "market": [
    {
      "id": 1,
      "description": "london",
      "macroarea": "LN",
      "salesmanager": "manager",
      "salesprice": 8991,
      "cost": 8991,
      "history": [
        {
          "historydate": "2020-03-31",
          "quantity": 1,
          "ordlines": 1
        },
        {
          "historydate": "2020-03-31",
          "quantity": 1,
          "ordlines": 1
        }
      ]
    }
  ]
}

```

e.g. Model 2

```auto
{
  "id": 20,
  "productid": "abc",
  "description": "description",
  "category": {
    "value": "category",
    "description": "category"
  },
  "supercategory": {
    "value": "supercategory",
    "description": "supercategory"
  },
  "servicetype": {
    "value": "N",
    "description": "N"
  },
  "itemstatus": {
    "value": "A",
    "description": "A"
  },
  "vendor": {
    "value": "123",
    "description": "123"
  },
  "market": [
    {
      "id": 1,
      "description": "market 1",
      "salesareatype": "market type",
      "area": "area",
      "cost": 7.95957,
      "history": [
        {
          "historydate": "2020-01-31T00:00:00",
          "quantity": 4,
          "ordlines": 0,
          "exquantity": 0
        },
        {
          "historydate": "2020-06-30T00:00:00",
          "quantity": 4,
          "ordlines": 0,
          "exquantity": 0
        }
      ]
    }
  ]
}

```

Thank you,  
Krishna

---

<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 17, 2021, 9:45am UTC](https://discuss.elastic.co/t/nest-client-mapping-aggregations-search-for-dynamic-properties-attributes-of-a-model/264544/2 "2021-03-17T09:45:03Z")

</div>

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