Hello! I have such a JsonObject:
{
"success": true,
"type": "message",
"body": {
"_id": "5215bdd32de81e0c0f000005",
"id": "411c79eb-a725-4ad9-9d82-2db54dfc80ee",
"type": "metaModel",
"title": "testchang",
"authorId": "5215bd552de81e0c0f000001",
"drawElems": [
{
"type": "App.draw.metaElem.ModelStartPhase",
"id": "27re7e35-550j",
"x": 60,
"y": 50,
"width": 50,
"height": 50,
"title": "problem engagement",
"isGhost": true,
"pointTo": "e88e2845-37a4-4c45-a030-d02a3c3e03f9",
"bindingId": "90f79d70-0afc-11e3-98d2-83967d2ad9a6",
"model": "meta",
"entityType": "phase",
"domainId": "411c79eb-a725-4ad9-9d82-2db54dfc80ee",
"authorId": "5215bd552de81e0c0f000001",
"userData": {},
"_id": "5215f4c5d89f629c1700000d"
},
{...}
]
}}
I want to index only parts of this object, so I defined an explicit mapping
by myself and disabled the dynamic mapping. here is the mapping:
String mapping=XContentFactory.jsonBuilder().startObject().
startObject("domaindata").field("dynamic","false").
startObject("properties")
.startObject("success").field("type","string").endObject()
.startObject("type").field("type","string").endObject()
.startObject("body").field("type", "object")
.startObject("properties")
.startObject("id").field("type","string").field("store","yes").endObject()
.startObject("type").field("type","string").field("store","yes").endObject()
.startObject("title").field("type","integer").field("store","yes").endObject()
.startObject("drawElems").field("type","nested")
.startObject("properties")
.startObject("type").field("store","yes").field("type","string").endObject()
.startObject("title").field("store","yes").field("type","string").endObject()
.endObject().endObject().endObject().endObject().endObject().endObject().endObject().string();
I added this mapping in my index:
node.client().admin()
.indices().prepareCreate("testdomaindata")
.addMapping("domaindata", mapping)
.execute().actionGet();
and indexed with following code:
node.client().prepareBulk().add(node.client()
.prepareIndex("testdomaindata","domaindata",string).setSource(responseDomainData1))
.execute().actionGet();
I used the GetResponse and Head Plugin to check if the jsonObject is
indexed correctly. But the problem is with this mapping, the jsonObject
seems to be not indexed at all. In head plugin, the index and type has been
created but there is no doc in this index and type.
Did I define a incorrect mapping? Or there are some mistakes in my other
codes? Could anybody give me some advices? Thanks a lot!
--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.