Not sure what a SENSE script is but below is how to reproduce this. Let me 
know if this makes sense. 

Thank you for helping. 

-Ankit

ankit$ curl -XPUT http://localhost:9200/test -d '"mappings": { "test": { 
"properties": { "deviceId": { "type": "string", "index": "not_analyzed" }, 
"basics": { "type": "nested", "properties": { "sex": { "type": "string", 
"index": "not_analyzed" }, "device": { "type": "string", "index": 
"not_analyzed" } } } } } } }'

{"acknowledged":true}

ankit$ curl -XPUT 'http://localhost:9200/test/test/1' -d '{ "basics": { 
"sex": "m", "device": "LGE LG-P768" }, "deviceId": "1" }'

{"_index":"test","_type":"test","_id":"1","_version":1,"created":true}

ankit$ curl -XPUT 'http://localhost:9200/test/test/2' -d '{ "basics": { 
"sex": "m", "device": "Samsung SHW-M250S" }, "deviceId": "2" }'

{"_index":"test","_type":"test","_id":"2","_version":1,"created":true}

ankit$ curl -XGET 
'http://localhost:9200/test/test/_search?search_type=count&pretty' -d '{ 
"aggregations": { "popular_devices": { "terms": { "field": "device" } } } }'

{

  "took" : 2,

  "timed_out" : false,

  "_shards" : {

    "total" : 5,

    "successful" : 5,

    "failed" : 0

  },

  "hits" : {

    "total" : 2,

    "max_score" : 0.0,

    "hits" : [ ]

  },

  "aggregations" : {

    "popular_devices" : {

      "buckets" : [ {

        "key" : "lg",

        "doc_count" : 1

      }, {

        "key" : "lge",

        "doc_count" : 1

      }, {

        "key" : "m250s",

        "doc_count" : 1

      }, {

        "key" : "p768",

        "doc_count" : 1

      }, {

        "key" : "samsung",

        "doc_count" : 1

      }, {

        "key" : "shw",

        "doc_count" : 1

      } ]

    }

  }

}

On Thursday, July 3, 2014 1:08:13 AM UTC-7, David Pilato wrote:
>
> Yes. Using not_analyzed is the way to go.
> May be you could create a SENSE script and gist it so we can see what you 
> did wrong?
>
> --
> David ;-)
> Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
>
>
> Le 3 juil. 2014 à 09:47, Ankit Jain <[email protected] <javascript:>> a 
> écrit :
>
> Hey Folks, how do I do aggregations on a multi word field? i.e. if i have 
> a field named "device model" which could have "samsung galaxy s5" or 
> "iphone 5s" when I do an aggregation, it aggregates "samsung" separately 
> from "galaxy" separately from "s5"... ideas?
>
> I tried defining the index with a mapping where that field has index : 
> not_analyzed set... 
>
> Thanks in advance,
> Ankit! 
>
> -- 
> 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/433ae04a-73b4-462d-9be0-d5f20ff6c42f%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/elasticsearch/433ae04a-73b4-462d-9be0-d5f20ff6c42f%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/bbf49792-7f19-4359-b53f-860d8ddb16b7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to