Indexing nested json

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Indexing nested json

kasinger, james
Hi folks,
Has anyone had success indexing nested json into solr? I know that solr prefers a flattened representation of the data, but I’m exploring potential solutions or workarounds for achieving this. Thanks in advance.

For instance I’m indexing this “document” and expect it to be presented in solr in the same way.

{
        "rolledupcolors": [
         {
            "Name": "BURGUNDY",
            "ManiImageUrl":"1/_102069221.jpg",
            "AltImageUrl":"3/_102067603.jpg",
            "RGB":"",
            "ColorFamily":"Red,Purple",
            "SwatchImageUrl":"2/_102067602.jpg"
          },
          {
              "Name": "CHARCOAL",
               ........
          }
      ]
}

James


Reply | Threaded
Open this post in threaded view
|

Re: Indexing nested json

Shawn Heisey-2
On 3/8/2018 10:17 AM, kasinger, james wrote:

> Has anyone had success indexing nested json into solr? I know that solr prefers a flattened representation of the data, but I’m exploring potential solutions or workarounds for achieving this. Thanks in advance.
>
> For instance I’m indexing this “document” and expect it to be presented in solr in the same way.
>
> {
>         "rolledupcolors": [
>          {
>             "Name": "BURGUNDY",
>             "ManiImageUrl":"1/_102069221.jpg",
>             "AltImageUrl":"3/_102067603.jpg",
>             "RGB":"",
>             "ColorFamily":"Red,Purple",
>             "SwatchImageUrl":"2/_102067602.jpg"
>           },
>           {
>               "Name": "CHARCOAL",
>                ........
>           }
>       ]
> }

I don't see anything particularly nested about that document.  Maybe
there's something really obvious about it that I'm somehow not seeing. 
If that's the case, that would be my fault.

What is Solr doing that doesn't meet with your expectations, and what do
you expect it to do?

(This question is still pretty general, but if it starts to get
specific, then specific information like Solr version and other details
may be needed)

Thanks,
Shawn

Reply | Threaded
Open this post in threaded view
|

Re: Indexing nested json

Mikhail Khludnev-2
In reply to this post by kasinger, james
Will
https://lucene.apache.org/solr/guide/7_1/transforming-and-indexing-custom-json.html
work
for you?

On Thu, Mar 8, 2018 at 8:17 PM, kasinger, james <
[hidden email]> wrote:

> Hi folks,
> Has anyone had success indexing nested json into solr? I know that solr
> prefers a flattened representation of the data, but I’m exploring potential
> solutions or workarounds for achieving this. Thanks in advance.
>
> For instance I’m indexing this “document” and expect it to be presented in
> solr in the same way.
>
> {
>         "rolledupcolors": [
>          {
>             "Name": "BURGUNDY",
>             "ManiImageUrl":"1/_102069221.jpg",
>             "AltImageUrl":"3/_102067603.jpg",
>             "RGB":"",
>             "ColorFamily":"Red,Purple",
>             "SwatchImageUrl":"2/_102067602.jpg"
>           },
>           {
>               "Name": "CHARCOAL",
>                ........
>           }
>       ]
> }
>
> James
>
>
>


--
Sincerely yours
Mikhail Khludnev
Reply | Threaded
Open this post in threaded view
|

Re: Indexing nested json

kasinger, james
Not quite. This will index the nested json into a flattened representation of the data, in multiple documents. We expect the resulting document to contain all the same nested fields as the json had. It should be identical.

Thanks for your response,
Jams

On 3/8/18, 1:26 PM, "Mikhail Khludnev" <[hidden email]> wrote:

    Will
    https://lucene.apache.org/solr/guide/7_1/transforming-and-indexing-custom-json.html
    work
    for you?
   
    On Thu, Mar 8, 2018 at 8:17 PM, kasinger, james <
    [hidden email]> wrote:
   
    > Hi folks,
    > Has anyone had success indexing nested json into solr? I know that solr
    > prefers a flattened representation of the data, but I’m exploring potential
    > solutions or workarounds for achieving this. Thanks in advance.
    >
    > For instance I’m indexing this “document” and expect it to be presented in
    > solr in the same way.
    >
    > {
    >         "rolledupcolors": [
    >          {
    >             "Name": "BURGUNDY",
    >             "ManiImageUrl":"1/_102069221.jpg",
    >             "AltImageUrl":"3/_102067603.jpg",
    >             "RGB":"",
    >             "ColorFamily":"Red,Purple",
    >             "SwatchImageUrl":"2/_102067602.jpg"
    >           },
    >           {
    >               "Name": "CHARCOAL",
    >                ........
    >           }
    >       ]
    > }
    >
    > James
    >
    >
    >
   
   
    --
    Sincerely yours
    Mikhail Khludnev
   

Reply | Threaded
Open this post in threaded view
|

Re: Indexing nested json

Rick Leir-2
Hi James
Yonick has a great blog explaining that, but I am on the bus so I do not have a link for you.

Yes, you can use nesting, and there are good reasons for doing so, but you will find it much easier to use flat fields. YMMV
Cheers -- Rick


On March 8, 2018 5:22:13 PM EST, "kasinger, james" <[hidden email]> wrote:

>Not quite. This will index the nested json into a flattened
>representation of the data, in multiple documents. We expect the
>resulting document to contain all the same nested fields as the json
>had. It should be identical.
>
>Thanks for your response,
>Jams
>
>On 3/8/18, 1:26 PM, "Mikhail Khludnev" <[hidden email]> wrote:
>
>    Will
>https://lucene.apache.org/solr/guide/7_1/transforming-and-indexing-custom-json.html
>    work
>    for you?
>    
>    On Thu, Mar 8, 2018 at 8:17 PM, kasinger, james <
>    [hidden email]> wrote:
>    
>    > Hi folks,
>> Has anyone had success indexing nested json into solr? I know that
>solr
>> prefers a flattened representation of the data, but I’m exploring
>potential
>    > solutions or workarounds for achieving this. Thanks in advance.
>    >
>> For instance I’m indexing this “document” and expect it to be
>presented in
>    > solr in the same way.
>    >
>    > {
>    >         "rolledupcolors": [
>    >          {
>    >             "Name": "BURGUNDY",
>    >             "ManiImageUrl":"1/_102069221.jpg",
>    >             "AltImageUrl":"3/_102067603.jpg",
>    >             "RGB":"",
>    >             "ColorFamily":"Red,Purple",
>    >             "SwatchImageUrl":"2/_102067602.jpg"
>    >           },
>    >           {
>    >               "Name": "CHARCOAL",
>    >                ........
>    >           }
>    >       ]
>    > }
>    >
>    > James
>    >
>    >
>    >
>    
>    
>    --
>    Sincerely yours
>    Mikhail Khludnev
>    

--
Sorry for being brief. Alternate email is rickleir at yahoo dot com