Home > other >  Elastic Search: Creating or later adding new field parallel to "_id" or "_source"
Elastic Search: Creating or later adding new field parallel to "_id" or "_source"

Time:10-05

I am very new to Elastic Search. I have a question. Is it possible to create or later add new field that is in the same level (i.e., parallel to) standard top-level fields like "_id", "_type", "_source" etc.? Please note that I am not looking to create those new fields in JSON content that is under "_source". Thank you in advance!

Just an example: In the following content in ES, can I re-ingest new field say "_location":

Before update/re-ingestion:

{
   "_index":"my_index",
   "_type":"twitter_stream",
   "_id":"1234567890",
   "_score":1.0,
   "_source":{<JSON twitter data content>}
}

After update/re-ingestion:

{
   "_index":"my_index",
   "_type":"twitter_stream",
   "_id":"1234567890",
   "_score":1.0,
   "_location": "Miami",
   "_source":{<JSON twitter data content>}
}

CodePudding user response:

No, these are document's special fields. User-defined fields can only be added to _source, by adding them to index mapping.

  • Related