Json formatting requirement to index


(Wang Yanshan) #1

Hi all,

my Json file is attached below. I got an parsing error when indexing the json file using Java API. Is there any requirement for Json? How can I fix this error?

Error:
Exception in thread "main" org.elasticsearch.index.mapper.MapperParsingException: failed to parse [METADATA.disease]
at org.elasticsearch.index.mapper.core.AbstractFieldMapper.parse(AbstractFieldMapper.java:409)
at org.elasticsearch.index.mapper.object.ObjectMapper.serializeObject(ObjectMapper.java:554)
at org.elasticsearch.index.mapper.object.ObjectMapper.serializeNonDynamicArray(ObjectMapper.java:685)
at org.elasticsearch.index.mapper.object.ObjectMapper.serializeArray(ObjectMapper.java:604)
at org.elasticsearch.index.mapper.object.ObjectMapper.parse(ObjectMapper.java:489)
at org.elasticsearch.index.mapper.object.ObjectMapper.serializeObject(ObjectMapper.java:554)
at org.elasticsearch.index.mapper.object.ObjectMapper.parse(ObjectMapper.java:487)
at org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:544)
at org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:493)
at org.elasticsearch.index.shard.IndexShard.prepareIndex(IndexShard.java:480)
at org.elasticsearch.action.index.TransportIndexAction.shardOperationOnPrimary(TransportIndexAction.java:192)
at org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$AsyncShardOperationAction.performOnPrimary(TransportShardReplicationOperationAction.java:515)
at org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$AsyncShardOperationAction$1.run(TransportShardReplicationOperationAction.java:422)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.elasticsearch.ElasticsearchIllegalArgumentException: unknown property [name]
at org.elasticsearch.index.mapper.core.StringFieldMapper.parseCreateFieldForString(StringFieldMapper.java:331)
at org.elasticsearch.index.mapper.core.StringFieldMapper.parseCreateField(StringFieldMapper.java:277)
at org.elasticsearch.index.mapper.core.AbstractFieldMapper.parse(AbstractFieldMapper.java:399)
... 15 more

Json:
{
"DOCNO": "210",
"METADATA": {
"dataAcquisition": [
{
"title": "MR"
}
],
"dataItem": {
"dataTypes": [
"dataset",
"disease",
"organism",
"dataRepository",
"organization",
"dataAcquisition",
"anatomicalPart"
]
},
"anatomicalPart": [
{
"name": "Prostate"
}
],
"dataRepository": {
"abbreviation": "TCIA",
"homePage": "http://www.cancerimagingarchive.net",
"name": "The Cancer Imaging Archive ",
"ID": "SCR:008927"
},
"disease": [
{
"name": "cancer"
}
],
"dataset": {
"status": "Ongoing",
"relatedDataset": "3D Segmentations provided as part of NCI-ISBI 2013 Challenge - Automated Segmentation of Prostate Structures (NRRD) and NCI-MICCAI 2013 Challenge - Automated Segmentation of Prostate Structures (MHA).",
"license": "Public",
"creator": [
"Radboud"
],
"title": "Prostate-3T",
"downloadURL": "https://wiki.cancerimagingarchive.net/display/Public/Prostate-3T",
"dateLastUpdate": "20130531T000000+0000",
"ID": "Prostate-3T",
"size": "64"
},
"organization": {
"abbreviation": "FNLCR",
"homePage": "http://frederick.cancer.gov/",
"name": "Frederick National Laboratory for Cancer Research",
"ID": "SCR:011245"
},
"organism": [
{
"scientificName": "Homo sapiens",
"name": "human"
}
]
},
"REPOSITORY": "cia_030216",
"TITLE": "Prostate-3T"
}


(David Pilato) #2

Please format your code using </> icon. It will make your post more readable.

Your JSON is correct so you are may be doing something else wrong.


(system) #3