Hello

Thanks u very much!

How to configure Analyzer to an aggregation?

在 2014年6月28日星期六UTC+8下午3时17分34秒,Cédric Hourcade写道:
>
> Hello, 
>
> Is your field user_visited configured to use your keywordAnalyzer 
> analyzer ? Can you post your index mapping? 
>
> Cédric Hourcade 
> [email protected] <javascript:> 
>
>
> On Fri, Jun 27, 2014 at 11:21 AM, Helennie Nie <[email protected] 
> <javascript:>> wrote: 
> > Hi there 
> > A field in my documents is a url like : 
> > http://search.ehaier.com/_bpocbmuwbjulbfxy-se.html 
> > and I set my analyzer as keyword analyzer with java api, but when I use 
> > aggregation to calculate the sum of urls, it returns the number of terms 
> in 
> > the url, like : 
> > "key":"http" 
> > "doc_count": 29662 
> > 
> > what i want is store the whole url as a term, I tried to set the 
> analyzer, 
> > but it dosent work at all 
> > 
> > here are the related codes: 
> > 
> > set analyzer as keyword analyzer: 
> > 
> > UpdateSettingsRequestBuilder settingsRequest = 
> > client.admin().indices().prepareUpdateSettings(); 
> >      client.admin().indices().prepareCreate("lzhd") 
> > 
> > 
> .setSettings(ImmutableSettings.settingsBuilder().loadFromSource(jsonBuilder() 
>
> >             .startObject() 
> >                 .startObject("analysis") 
> >                     .startObject("analyzer") 
> >                         .startObject("keywordAnalyzer") 
> >                             .field("type", "keyword") 
> >                         .endObject() 
> >                     .endObject() 
> >                 .endObject() 
> >             .endObject().string())) 
> >         .execute().actionGet(); 
> > 
> > 
> > json for aggregation: 
> > 
> > GET _search 
> > { 
> >     "aggs":{ 
> >         "user_visited":{ 
> >             "terms":{ 
> >                 "field":"url" 
> >             } 
> >         } 
> >     } 
> > } 
> > 
> > 
> > some resualts: 
> > "aggregations": { 
> >       "user_visited": { 
> >          "buckets": [ 
> >             { 
> >                "key": "http", 
> >                "doc_count": 29662 
> >             }, 
> >             { 
> >                "key": "html", 
> >                "doc_count": 16202 
> >             }, 
> > 
> > 
> > 
> > 
> > -- 
> > 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] <javascript:>. 
> > To view this discussion on the web visit 
> > 
> https://groups.google.com/d/msgid/elasticsearch/3e048972-27ee-4fd7-9559-ad8ef9d24303%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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/42013a4a-db7f-4d60-9522-081520cbfdc4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to