# Providing field mapping, analysis, etc on the fly

**URL:** <https://discuss.elastic.co/t/providing-field-mapping-analysis-etc-on-the-fly/75108>\
**Category:** Elasticsearch\
**Created:** [February 14, 2017, 8:29pm UTC](https://discuss.elastic.co/t/providing-field-mapping-analysis-etc-on-the-fly/75108 "2017-02-14T20:29:57Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![lukes](https://avatars.discourse-cdn.com/v4/letter/l/4da419/32.png) [@lukes](https://discuss.elastic.co/u/lukes)\
**Post date:** [February 14, 2017, 8:29pm UTC](https://discuss.elastic.co/t/providing-field-mapping-analysis-etc-on-the-fly/75108/1 "2017-02-14T20:29:57Z")

</div>

Hi all,

Is it possible to provide the fields mapping, analysis, etc in the payload itself ? What i mean is, assuming i have the JSON payload with fields in it

```
{
    "account_number": 0,
    "balance": 16623,
    "firstname": "Bradshaw",
    "lastname": "Mckenzie",
    "age": 29,
    "gender": "F",
    "address": "244 Columbus Place",
    "employer": "Euron",
    "email": "bradshawmckenzie@euron.com",
    "city": "Hobucken",
    "state": "CO"
}

```

Is it possible to provide metadata about fields like

```
"firstname" : {
       "type" : "string",
       "value" : "Bradshaw",
       "analysis": {
       "analyzer": {
        "std_folded": { 
          "type": "custom",
          "tokenizer": "standard",
          "filter": [
            "lowercase",
            "asciifolding"
           ]
         }
       }
     }
  }

```

with the payload rather than providing mapping on the index level ? Reason i am asking is, our schema wouldn't be well defined as all the documents/payload will have randoms field names and counts. Field Name in one document could be int and long in other document.

Any help or pointer is much appreciated.

Regards,  
Lukes

---

<div class="post-metadata">

**Author:** ![lukes](https://avatars.discourse-cdn.com/v4/letter/l/4da419/32.png) [@lukes](https://discuss.elastic.co/u/lukes)\
**Post date:** [February 15, 2017, 6:47am UTC](https://discuss.elastic.co/t/providing-field-mapping-analysis-etc-on-the-fly/75108/2 "2017-02-15T06:47:09Z")

</div>

Can anyone please provide some input ?

Regards,  
Lukes

---

<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:** [February 15, 2017, 6:53am UTC](https://discuss.elastic.co/t/providing-field-mapping-analysis-etc-on-the-fly/75108/3 "2017-02-15T06:53:49Z")

</div>

Each field in an index must have a single mapping, so it is not possible to set this per document.

---

<div class="post-metadata">

**Author:** ![lukes](https://avatars.discourse-cdn.com/v4/letter/l/4da419/32.png) [@lukes](https://discuss.elastic.co/u/lukes)\
**Post date:** [February 15, 2017, 7:21pm UTC](https://discuss.elastic.co/t/providing-field-mapping-analysis-etc-on-the-fly/75108/4 "2017-02-15T19:21:24Z")

</div>

Thanks @Christian_Dahlqvist. Then i'll put the naming conventions in my fields itself.

Regards,  
Lukes

---

<div class="post-metadata">

**Author:** ![lukes](https://avatars.discourse-cdn.com/v4/letter/l/4da419/32.png) [@lukes](https://discuss.elastic.co/u/lukes)\
**Post date:** [February 21, 2017, 10:11pm UTC](https://discuss.elastic.co/t/providing-field-mapping-analysis-etc-on-the-fly/75108/5 "2017-02-21T22:11:12Z")

</div>

Is it possible to have wildcard type fields mapping ? What i mean is, like in SOLR we can define dynamicFields mapping saying map `*_txt_en` to `text_en` and then we define text\_en as text field with english analyzer and so on. I tried

```
{
  "mappings": {
    "type1": {
      "properties": {
        "*_i_en": {
          "type": "integer"
        }
      }
    }
  }
}

```

and tried indexing below field  
{  
"age\_i\_en":25  
}

I checked metadata and it was indexed as long, but not as integer. What i am trying to achieve is define wildcard/regular expression type mappings, so that i can define customize pipelines and so on. And during runtime fields names will get resolved automatically and this way i don't have to define/tie fields names. Also during query time is it possible to specify "age\_i\_\*" as query field rather than complete name, so that if i have fields with multiple languages then i don't have to iterate over each of them ?

Regards,  
Lukes

---

<div class="post-metadata">

**Author:** ![lukes](https://avatars.discourse-cdn.com/v4/letter/l/4da419/32.png) [@lukes](https://discuss.elastic.co/u/lukes)\
**Post date:** [February 22, 2017, 7:47pm UTC](https://discuss.elastic.co/t/providing-field-mapping-analysis-etc-on-the-fly/75108/6 "2017-02-22T19:47:27Z")

</div>

Hi experts, can anyone help please ?

Regards,  
Lukes

---

<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 22, 2017, 7:47pm UTC](https://discuss.elastic.co/t/providing-field-mapping-analysis-etc-on-the-fly/75108/7 "2017-03-22T19:47:44Z")

</div>

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