Re: Specify metadata per word/term in a string

2014-04-30 Thread joergpra...@gmail.com
There is a related feature that is called payloads for terms. In
Elasticsearch you can assign payload to terms, e.g. numbers for custom
scoring.

See also

https://github.com/elasticsearch/elasticsearch/issues/3772
https://github.com/elasticsearch/elasticsearch/pull/4161

It uses DelimitedPayloadTokenFilter

http://lucene.apache.org/core/4_7_0/analyzers-common/org/apache/lucene/analysis/payloads/DelimitedPayloadTokenFilter.html

Jörg



On Wed, Apr 30, 2014 at 1:06 PM, Neeraj Makam  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 elasticsearch+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/elasticsearch/f5f40059-e9e7-4a05-93f8-aacdff26abb0%40googlegroups.com
> .
> 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 elasticsearch+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/CAKdsXoEV56vGmxgKceY5dcSkEsJwEwrmtVXona-MH298YOExnQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Specify metadata per word/term in a string

2014-04-30 Thread Neeraj Makam
hi, thanks for the answer.
But that would stop me from enabling highlighting for such queries. Can you 
think of any workaround for highlighting also to work? 

-- 
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 elasticsearch+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/ace6896e-bbd5-48d5-a4fa-bd9d4e6d7a0f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Specify metadata per word/term in a string

2014-04-30 Thread vineeth mohan
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  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 elasticsearch+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/elasticsearch/f5f40059-e9e7-4a05-93f8-aacdff26abb0%40googlegroups.com
> .
> 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 elasticsearch+unsubscr...@googlegroups.com.
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.


Specify metadata per word/term in a string

2014-04-30 Thread Neeraj Makam
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 elasticsearch+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/f5f40059-e9e7-4a05-93f8-aacdff26abb0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.