Could any one help me for a ES query for sum of two nested object fields of a document,
for example,
"_source": {
"Identification": {
"PAYL_HDR": {
"DUNS_NBR": "212003857",
"GEO_REF_ID": "1067",
"GSRL_DT": "2017-08-22T15:24:46.000000",
"INFO_SRC_CD": 20008,
"REC_TYP_CD": 11592
}
}
},
above is the sample data contains in my es document, I need to add INFO_SRC_CD and REC_TYP_CD and show the result in a custom field which will be shown along the all fields of _source.
Could you provide a full recreation script as described in About the Elasticsearch category. It will help to better understand what you are doing. Please, try to keep the example as simple as possible.
A full reproduction script will help readers to understand, reproduce and if needed fix your problem. It will also most likely help to get a faster answer.
Yes, thank you very much for your response. But when I hit this request, I am getting the below runtime error.
Fielddata is disabled on text fields by default. Set fielddata=true on [Identification.PAYL_HDR.INFO_SRC_CD] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory. Alternatively use a keyword field instead.
If it works with keyword, it means the field is most likely defined as a keyword in the mapping. You must check your mapping and consider updating these fields to integer or long as you wanted to sum these 2 fields.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.