Mapping for Nested Index


#1

I have a large (481k lines) json document with nested arrays of objects. Here's an example:

"ICD10CM.index": {
"version": "2017",
"title": "ICD-10-CM INDEX TO DISEASES and INJURIES",
"letter": [
{
"title": "A",
"mainTerm": [
{
"title": "Aarskog's syndrome",
"code": "Q87.1"
},
{
"title": "Abandonment",
"see": "Maltreatment"
},
{
"title": {
"nemod": "(-astasia) (hysterical)",
"text": "Abasia",
"toString": [
null
]
},
"code": "F44.4"
},
{
"title": {
"nemod": "(cystinosis)",
"text": "Abderhalden-Kaufmann-Lignac syndrome",
"toString": [
null
]
},
"code": "E72.04"
}

To get it to index, do I first have to manually create the mapping of this entire document using "type":"nested"?

e.g.,
{
"mappings": {
"blahblah": {
"properties": {
"ICD10CM.index": {
"type": "string",
"version": {
"type": "string"
},
"title": {
"type": "string"
},
"letter": {
"type": "nested",
"title": {
"type": "string"
},
"mainterm": {
"type": "nested"
"title": {
"type": "string",
},
"code": {
"type": "string"
},
"title": {
"type": "string"
},
"see": {
"type": "string"
},
"title": {
"type": "nested",
"nemod"
}
}
}
}
}
}
}
}
}


(Christian Dahlqvist) #2

In your document you have a field 'title', which is mapped both to a string and an object. As each field must be mapped to a single type in an index, you will need to change the structure of this document before indexing it into Elasticsearch.


#3

Great catch. Will fix that and try indexing again.


(system) #4

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