Error while indexing jsonld document in elastic search 2.3.5

Hello Team,

I am trying to index a nested JSONLD document file into elasticSearch 2.3.5 and not sucessful in indexing.

Please find below the details,

  1. Elastic Search Version : 2.3.5

  2. My mapping file is

curl -XPUT "http://localhost:9200/sample" -d'
{
"mappings": {
"movie": {
"properties": {
"cast": {
"type": "nested"
}
}
}
}
}'

  1. My jsonld file name : sample.json

{
"@graph" : [ {
"@id" : "http://www.xyz.com/ABC/BUSE/Arrest",
"Bus" : "http://www.xyz.com/ABC/Bus/Decline",
"LevelBus" : "http://www.xyz.com/ABC/LevelBus/Medium"
}, {
"@id" : "http://www.xyz.com/ABC/EV/Aging_signs",
"IType" : "http://www.xyz.com/ABC/IType/Common",
"STEPS" : "http://www.xyz.com/ABC/STEPS/Middle_age"
}, {
"@id" : "http://www.xyz.com/ABC/EV/Arrest",
"IType" : "http://www.xyz.com/ABC/IType/High_I",
"STEPS" : "http://www.xyz.com/ABC/STEPS/Adolescent"
}, {
"@id" : "http://www.cbox/complaints/movie",
"BUSE" : "http://www.xyz.com/ABC/BUSE/Arrest",
"http://www.xyz.com/ABC#RT" : "Hi I'm Mr Sum here This is my 1st time join with them and previously i have sign new sim card last month with them about 2 year so far this was very disappointed I'm working in Sheng Siong Tanglin Halt Road I cannot received any signal for my card even a call or message!",
"EDB" : [ "http://dbporg/resource/Telephone_number", "http://dbporg/resource/Subscriber_identity_module", "http://dbporg/resource/Singtel", "http://dbporg/resource/ASAP_(variety_show)", "http://dbporg/resource/Sign", "http://dbporg/resource/Omake", "http://dbporg/resource/Message_passing", "http://dbporg/resource/Telephone_call", "http://dbporg/resource/Wikipedia", "http://dbporg/resource/Wonder_(emotion)", "http://dbporg/resource/Railway_signal", "http://dbporg/resource/Sophomore", "http://dbporg/resource/Sheng_Siong", "http://dbporg/resource/StarHub", "http://dbporg/resource/Receiver_(information_theory)", "http://dbporg/resource/Sathya_Sai_Baba", "http://dbporg/resource/Settling", "http://dbporg/resource/Causality", "http://dbporg/resource/System_time", "http://dbporg/resource/Playing_card", "http://dbporg/resource/Summation", "http://dbporg/resource/Road", "http://dbporg/resource/Tanglin", "http://dbporg/resource/Solutions_of_the_Einstein_field_equations", "http://dbporg/resource/Aishō,_Shiga", "http://dbporg/resource/M1_motorway", "http://dbporg/resource/Printing", "http://dbporg/resource/Iitaka_dimension", "http://dbporg/resource/Ur" ],
"http://www.xyz.com/ABC#IDT" : [ "about 2 year", "last month", "previously" ],
"http://www.xyz.com/ABC#IOR" : "SIngTel",
} ],
"@context" : {
"EDB" : {
"@id" : "http://www.xyz.com/ABC#EDB",
"@type" : "@id"
},
"IDT" : {
"@id" : "http://www.xyz.com/ABC#IDT",
"@type" : "http://www.w3org/2001/XMLSchema#string"
},
"IOR" : {
"@id" : "http://www.xyz.com/ABC#IOR",
"@type" : "http://www.w3org/2001/XMLSchema#string"
},
"BUSE" : {
"@id" : "http://www.xyz.com/ABC#BUSE",
"@type" : "@id"
},
"IAS" : {
"@id" : "http://www.xyz.com/ABC#IAS",
"@type" : "@id"
},
"RT" : {
"@id" : "http://www.xyz.com/ABC#RT",
"@type" : "http://www.w3org/2001/XMLSchema#string"
},
"IType" : {
"@id" : "http://www.xyz.com/ABC/EV#IType",
"@type" : "@id"
},
"STEPS" : {
"@id" : "http://www.xyz.com/ABC/EV#STEPS",
"@type" : "@id"
},
"LevelBus" : {
"@id" : "http://www.xyz.com/ABC/BUSE#LevelBus",
"@type" : "@id"
},
"Bus" : {
"@id" : "http://www.xyz.com/ABC/BUSE#Bus",
"@type" : "@id"
}
}
}

4.Command to index my JSONLD file

curl -XPOST localhost:9200/sample/nested/1 -d @sample.json

  1. Error got while indexing is shown below,

Then I am pushing a JsonLD file which is a json document in the created index.

{"error":{"root_cause":[{"type":"mapper_parsing_exception","reason":"Field name [http://www.xyz.com/ABC#RT] cannot contain '.'"}],"type":"mapper_parsing_exception","reason":"Field name [http://www.xyz.com/ABC#RT] cannot contain '.'"},"status":400}

Please help me in indexing a jsonld document in elastic search 2.3.5

Hi @SindhujaM,

the error message says that dots in field names are unsupported so unfortunately you are out of luck with Elasticsearch 2.3.5. The good news is that this should work again with Elasticsearch 2.4 (not yet released).

For details, see the related pull request, which says that you need to set a system property mapper.allow_dots_in_name.

Daniel

In addition to what Daniel pointed out you also have at least one field ('EDB') which contains both an array of strings as well as an object. Each field in Elasticsearch must have a single type, so this will also not be allowed.

In addition to this it looks like you have some field names that might be dynamic, e.g. http://www.xyz.com/ABC#IOR. Although this is allowed (once you get rid of the dots), it can cause a lot of problems as mappings can grow very large, and therefore is something you should look into.