Hello Neeraj ,
First of all you cant return a "hello" from Elasticsearch.
Elasticsearch works on feed level basis.
Which means if you want to search hello , you will get the feed with the
text "hello elasticsearch search world" but not just hello.
Only way I can think of create a different document for each word. So a
document would look like -
{
"word" : "hello",
"code" : 25
}
here , you can get it worked.
If you want to retrieve the text also , give it as follows -
{
"text" : "hello from Elasticsearch" ,
"words" : [
{ "word" : "hello" , "count" : 25 } ,
{ "word" : "from" , "count" : 22}
]
}
WHERE words field is nested type.
Thanks
Vineeth
On Wed, Apr 30, 2014 at 4:36 PM, Neeraj Makam <[email protected]> wrote:
> Hi
>
> Given a text,say "hello elastic search world",
> is there a way i can associate a field or some metadata per word in the
> text on which i can later query?
> for eg: give code number to each word, and should be able to search like
> text = "hello" AND code = "25"
> i.e return all "hello" words which have 25 in their code metadata.
>
> --
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/elasticsearch/f5f40059-e9e7-4a05-93f8-aacdff26abb0%40googlegroups.com<https://groups.google.com/d/msgid/elasticsearch/f5f40059-e9e7-4a05-93f8-aacdff26abb0%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/CAGdPd5nwzNDRVkkxJ8qczgzFAacatg-tEQYaAkrk%2BeHRRcqthA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.