Archives of Support Questions (Read Only)

This is an archived board for historical reference. Information and links may no longer be available or relevant
Announcements
This board is archived and read-only for historical reference. To ask a new question, please post a new topic on the appropriate active board.

extractAvroPaths nested structure

avatar
Explorer

I'm having trouble extracting a nested structure from my avro data.

 

_attachment_body=[

{

    "username" : "alex"

    "date" : "21-08-2014"

    "attachments" : [

        "documents" : [

              {

                  "title": "test"

                  "tags" : [ "a", "b", "c" ]

              },

              {

                  "optional1" : "test2"

                  "title" : "test2"

              } ],

        "context" : "school"

    ]

}

 

Extracting the paths with Avro:

 

...

{ extractAvroPaths {

     flatten : true

     paths : {

         /my_user : /username       # this works fine

         # all three of these result in the same error message, with different patemeters

         /my_attachments : /attachments[]

         /my_documents : /attachments[]/documents[]

         /my_contexts : /attachments[]/documents[]/context

     }

  }

}

 

Results in the following error message:

com.typesafe.config.ConfigExceptionWrongType: morph-solr.conf: 30: Cannot concatenate object or list with a non-object-or-list, ConfigString("/my_attachments") and SimpleConfigList([]) are not compatible.

 

Eventualy I would like to map the fields to a solr index. So if its possible to extract the nested structures, the followup question would be how to map those to a solr schema, but lets take it one step at a time 🙂

1 ACCEPTED SOLUTION

avatar
Explorer

Srry too quick on the post trigger: this was just a matter of quoting the mapping:

 

 /my_attachments : "/attachments[]" 

 

The question remains how to map the structure to a solr index, but will post that in the appropriate section.

View solution in original post

2 REPLIES 2

avatar
Explorer

Srry too quick on the post trigger: this was just a matter of quoting the mapping:

 

 /my_attachments : "/attachments[]" 

 

The question remains how to map the structure to a solr index, but will post that in the appropriate section.

avatar
Super Collaborator
Try to use syntax with quotes, like so :

/my_contexts : "/attachments[]/documents[]/context"

Wolfgang.