search hit multivalued field

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

search hit multivalued field

nmz
Say I have a multivalued field(student[studentid, name]) in my
document[1234] with the following values :

        [1,bob]
        [2,alice]
        [3,carl]
        [4,scott]

I search for 'alice' and I get hit for doc: 1234.

From the searchHit is it possible to retrieve the 'studentId' for
which i got the hit? [In this case '2' corresponding to alice]

note: studentId[store : yes]
nmz
Reply | Threaded
Open this post in threaded view
|

Re: search hit multivalued field

nmz
Currently it cannot be done with elastic search.

On May 10, 3:00 pm, nmz <[hidden email]> wrote:

> Say I have a multivalued field(student[studentid, name]) in my
> document[1234] with the following values :
>
>         [1,bob]
>         [2,alice]
>         [3,carl]
>         [4,scott]
>
> I search for 'alice' and I get hit for doc: 1234.
>
> From the searchHit is it possible to retrieve the 'studentId' for
> which i got the hit? [In this case '2' corresponding to alice]
>
> note: studentId[store : yes]
Reply | Threaded
Open this post in threaded view
|

Re: search hit multivalued field

dadoonet

Does the parent / child or nested docs could help you ?

Does the highlight function could help you ?

 

Another idea could be to store a "technical" field (or use multifield), and put in it something like "1:bob" with a keyword analyzer (or no analyzer at all) and highlight this field.

 

BTW, if you are looking for students, why are you indexing documents ?

 

HTH

David.


Le 10 mai 2012 à 13:31, nmz <[hidden email]> a écrit :

> Currently it cannot be done with elastic search.
>
> On May 10, 3:00 pm, nmz <[hidden email]> wrote:
> > Say I have a multivalued field(student[studentid, name]) in my
> > document[1234] with the following values :
> >
> >         [1,bob]
> >         [2,alice]
> >         [3,carl]
> >         [4,scott]
> >
> > I search for 'alice' and I get hit for doc: 1234.
> >
> > From the searchHit is it possible to retrieve the 'studentId' for
> > which i got the hit? [In this case '2' corresponding to alice]
> >
> > note: studentId[store : yes]


--
David Pilato
http://dev.david.pilato.fr/
Twitter : @dadoonet

nmz
Reply | Threaded
Open this post in threaded view
|

Re: search hit multivalued field

nmz
I am not sure if it is a good idea to create parent child document,
where in I dont require any fields in the parent mapping.
The highlight function just helps me in the highlighting part. I need
to retrieve the id [not for displaying], for verification.

The student was just an example to state my problem, not my real
issue..

On May 10, 4:40 pm, "[hidden email]" <[hidden email]> wrote:

> Does the parent / child or nested docs could help you ?
> Does the highlight function could help you ?
>
> Another idea could be to store a "technical" field (or use multifield), and
> put in it something like "1:bob" with a keyword analyzer (or no analyzer at
> all) and highlight this field.
>
> BTW, if you are looking for students, why are you indexing documents ?
>
> HTH
> David.
>
> Le 10 mai 2012 à 13:31, nmz <[hidden email]> a écrit :
>
>
>
>
>
>
>
>
>
> > Currently it cannot be done with elastic search.
>
> > On May 10, 3:00 pm, nmz <[hidden email]> wrote:
> > > Say I have a multivalued field(student[studentid, name]) in my
> > > document[1234] with the following values :
>
> > >         [1,bob]
> > >         [2,alice]
> > >         [3,carl]
> > >         [4,scott]
>
> > > I search for 'alice' and I get hit for doc: 1234.
>
> > > From the searchHit is it possible to retrieve the 'studentId' for
> > > which i got the hit? [In this case '2' corresponding to alice]
>
> > > note: studentId[store : yes]
>
> --
> David Pilatohttp://dev.david.pilato.fr/
> Twitter : @dadoonet
Reply | Threaded
Open this post in threaded view
|

Re: search hit multivalued field

Amarthya Master
Did you implement a solution for this? I have a similar need where in search needs to happen on a field in a multi valued object, but from the hit highlights I would like to identify which object in the multi valued field got the match. Basically instead of just the hightlight fragments, would like to get back additional fields (for example, a unique id associated with the field in the multi valued object) included in the highlights results. 

Thinking of extending highlights query syntax such that you can specify additional decorator fields along with the field you want to highlight. These fields and the values of the fields will then be included in each hightlight fragment. Say a Key/Value pair of FieldName and FieldValue of all the aditional data. That would allow one to include the "id" field in my use case along with the hit highlights.

Let me know if it makes sense, and I would go ahead and implement this.

On Friday, May 11, 2012 2:45:11 AM UTC-7, nmz wrote:
I am not sure if it is a good idea to create parent child document,
where in I dont require any fields in the parent mapping.
The highlight function just helps me in the highlighting part. I need
to retrieve the id [not for displaying], for verification.

The student was just an example to state my problem, not my real
issue..

On May 10, 4:40 pm, "[hidden email]" <[hidden email]> wrote:

> Does the parent / child or nested docs could help you ?
> Does the highlight function could help you ?
>
> Another idea could be to store a "technical" field (or use multifield), and
> put in it something like "1:bob" with a keyword analyzer (or no analyzer at
> all) and highlight this field.
>
> BTW, if you are looking for students, why are you indexing documents ?
>
> HTH
> David.
>
> Le 10 mai 2012 à 13:31, nmz <[hidden email]> a écrit :
>
>
>
>
>
>
>
>
>
> > Currently it cannot be done with elastic search.
>
> > On May 10, 3:00 pm, nmz <[hidden email]> wrote:
> > > Say I have a multivalued field(student[studentid, name]) in my
> > > document[1234] with the following values :
>
> > >         [1,bob]
> > >         [2,alice]
> > >         [3,carl]
> > >         [4,scott]
>
> > > I search for 'alice' and I get hit for doc: 1234.
>
> > > From the searchHit is it possible to retrieve the 'studentId' for
> > > which i got the hit? [In this case '2' corresponding to alice]
>
> > > note: studentId[store : yes]
>
> --
> David Pilatohttp://dev.david.pilato.fr/
> Twitter : @dadoonet

--
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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.