You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by "kasinger, james" <ja...@nordstrom.com> on 2018/03/08 17:17:00 UTC
Indexing nested json
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
Re: Indexing nested json
Posted by Shawn Heisey <ap...@elyograg.org>.
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
Re: Indexing nested json
Posted by Rick Leir <rl...@leirtech.com>.
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" <ja...@nordstrom.com> 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" <mk...@apache.org> 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 <
> james.kasinger@nordstrom.com> 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
Re: Indexing nested json
Posted by "kasinger, james" <ja...@nordstrom.com>.
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" <mk...@apache.org> 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 <
james.kasinger@nordstrom.com> 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
Re: Indexing nested json
Posted by Mikhail Khludnev <mk...@apache.org>.
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 <
james.kasinger@nordstrom.com> 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