[
https://issues.apache.org/jira/browse/SOLR-7123?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15320793#comment-15320793
]
Anshum Gupta commented on SOLR-7123:
------------------------------------
There seems to be some issue here. Here's what I'm trying to do:
{code}
anshum$ curl -X POST -H 'Content:application/json'
"http://localhost:8983/solr/foo/update/json/docs?child.split=/children|/children/grandchildren&f=$FQN:/**&f=id:/children/id&f=name:/children/name&f=cat:/children/cat&f=id:/children/grandchildren/id&f=name:/children/grandchildren/name&f=cat:/children/grandchildren/cat&indent=true"
--data-binary '{"id":"1","name": "i am the parent","cat": "parent","children"
: [{"id": "1.1", "name": "i am the 1st child", "cat": "child"}, {"id":"1.2",
"name": "i am the 2nd child", "cat": "child", "grandchildren" : [{"id":
"1.2.1", "name": "i am the grandchild","cat" : "grandchild"}]}]}'
{code}
and here's the error
{code}
{
"responseHeader":{
"status":500,
"QTime":0},
"error":{
"msg":"All paths must start with '/' :/**",
"trace":"java.lang.RuntimeException: All paths must start with '/'
:/**\n\tat
org.apache.solr.common.util.JsonRecordReader.addField(JsonRecordReader.java:99)\n\tat
org.apache.solr.common.util.JsonRecordReader.getInst(JsonRecordReader.java:49)\n\tat
org.apache.solr.handler.loader.JsonLoader$SingleThreadedJsonLoader.handleSplitMode(JsonLoader.java:211)\n\tat
org.apache.solr.handler.loader.JsonLoader$SingleThreadedJsonLoader.processUpdate(JsonLoader.java:129)\n\tat
org.apache.solr.handler.loader.JsonLoader$SingleThreadedJsonLoader.load(JsonLoader.java:114)\n\tat
org.apache.solr.handler.loader.JsonLoader.load(JsonLoader.java:77)\n\tat
org.apache.solr.handler.UpdateRequestHandler$1.load(UpdateRequestHandler.java:97)\n\tat
org.apache.solr.handler.ContentStreamHandlerBase.handleRequestBody(ContentStreamHandlerBase.java:69)\n\tat
org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:156)\n\tat
org.apache.solr.core.SolrCore.execute(SolrCore.java:2036)\n\tat
org.apache.solr.servlet.HttpSolrCall.execute(HttpSolrCall.java:658)\n\tat
org.apache.solr.servlet.HttpSolrCall.call(HttpSolrCall.java:465)\n\tat
org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:257)\n\tat
org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:208)\n\tat
org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1668)\n\tat
org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:581)\n\tat
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)\n\tat
org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)\n\tat
org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226)\n\tat
org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1160)\n\tat
org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:511)\n\tat
org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)\n\tat
org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1092)\n\tat
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)\n\tat
org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:213)\n\tat
org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:119)\n\tat
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)\n\tat
org.eclipse.jetty.server.Server.handle(Server.java:518)\n\tat
org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:308)\n\tat
org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:244)\n\tat
org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:273)\n\tat
org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95)\n\tat
org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93)\n\tat
org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceAndRun(ExecuteProduceConsume.java:246)\n\tat
org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:156)\n\tat
org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:654)\n\tat
org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:572)\n\tat
java.lang.Thread.run(Thread.java:745)\n",
"code":500}}
{code}
When I try to add an explicit mapping for field 'id', here's what I get:
{code}
curl -X POST -H 'Content:application/json'
"http://localhost:8983/solr/foo/update/json/docs?child.split=/children|/children/grandchildren&f=id:/children/id&f=name:/children/name&f=cat:/children/cat&f=id:/children/grandchildren/id&f=name:/children/grandchildren/name&f=cat:/children/grandchildren/cat&indent=true"
--data-binary '{"id":"1","name": "i am the parent","cat": "parent","children"
: [{"id": "1.1", "name": "i am the 1st child", "cat": "child"}, {"id":"1.2",
"name": "i am the 2nd child", "cat": "child", "grandchildren" : [{"id":
"1.2.1", "name": "i am the grandchild","cat" : "grandchild"}]}]}'
anshum$ curl -X POST -H 'Content:application/json'
"http://localhost:8983/solr/foo/update/json/docs?child.split=/children|/children/grandchildren&f=id:/id&f=id:/children/id&f=name:/children/name&f=cat:/children/cat&f=id:/children/grandchildren/id&f=name:/children/grandchildren/name&f=cat:/children/grandchildren/cat&indent=true"
--data-binary '{"id":"1","name": "i am the parent","cat": "parent","children"
: [{"id": "1.1", "name": "i am the 1st child", "cat": "child"}, {"id":"1.2",
"name": "i am the 2nd child", "cat": "child", "grandchildren" : [{"id":
"1.2.1", "name": "i am the grandchild","cat" : "grandchild"}]}]}'
{
"responseHeader":{
"status":400,
"QTime":0},
"error":{
"metadata":[
"error-class","org.apache.solr.common.SolrException",
"root-error-class","org.apache.solr.common.SolrException"],
"msg":"Document contains multiple values for uniqueKey field: id=[1, 1.1,
1.2, 1.2.1]",
"code":400}}
{code}
We need to fix this before 6.1 goes out.
> /update/json/docs should have nested document support
> -----------------------------------------------------
>
> Key: SOLR-7123
> URL: https://issues.apache.org/jira/browse/SOLR-7123
> Project: Solr
> Issue Type: Improvement
> Reporter: Noble Paul
> Assignee: Noble Paul
> Labels: EaseOfUse
> Fix For: 6.1, master (7.0)
>
> Attachments: NestedDocumentMapper.java, SOLR-7123-test.patch,
> SOLR-7123.patch, SOLR-7123.patch
>
>
> It is the next logical step after SOLR-6304
> For the example document given below where the /orgs belong to a nested
> document,
> {code}
> {
> name: 'Joe Smith',
> phone: 876876687 ,
> orgs :[ {name : Microsoft,
> city: "Seattle,
> zip: 98052},
> {name: Apple,
> city : Cupertino,
> zip :95014 }
> ]
> }
> {code}
> The extra mapping parameters would be
> {noformat}
> split=/|/orgs&
> f=name:/orgs/name&
> f=city:/orgs/city&
> f=zip:/orgs/zip
> {noformat}
> * The objects at {{/org}} automatically becomes a child document because
> {{/org}} is a child path of{{/}}
> * All fields falling under the {{/orgs/}} will be mapped to the child document
> alternately you can just do
> {noformat}
> split=/|/orgs&f=$FQN:/**
> {noformat}
> The fully qualified name (FQN) for chiild docs begin from {{/org}}. So the
> output would be
> {noformat}
> {
> "name":"Joe Smith",
> "phone":876876687,
> "_childDocuments_":[
> {
> "name":"Microsoft",
> "city":"Seattle",
> "zip":98052},
> {
> "name":"Apple",
> "city":"Cupertino",
> "zip":95014}]}
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]