Providing field mapping, analysis, etc on the fly

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

Can anyone please provide some input ?

Regards,
Lukes

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

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

Regards,
Lukes

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

Hi experts, can anyone help please ?

Regards,
Lukes

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