Aggregation problem

Hey guys,

I have this mapping:

GET ckdocuments/msv/_mapping

{
"ckdocuments": {
"mappings": {
"msv": {
"properties": {
"MSV": {
"properties": {
"country": {
"type": "string",
"index": "not_analyzed"
},
"date": {
"type": "date",
"format": "YYYY-MM-dd HH:mm:ss"
},
"hits": {
"type": "nested",
"properties": {
"click_type": {
"type": "string",
"index": "not_analyzed"
}
}
}
}
},
"c": {
"type": "string",
"index": "not_analyzed"
},
"doc_creation_time": {
"type": "date",
"format": "YYYY-MM-dd HH:mm:ss"
},
"views": {
"properties": {
"country": {
"type": "string"
},
"date": {
"type": "date",
"format": "YYYY-MM-dd HH:mm:ss"
},
"hits": {
"properties": {
"click_type": {
"type": "string"
}
}
}
}
}
}
}
}
}
}

Wih these three docs:

PUT ckdocuments/msv/1
{
"c":"a",
"MSV" :
[
{
"country" : "US",
"date" : "2013-01-01 00:00:00",
"hits" : [
{
"click_type" : "click"
}
]
}
],
"views":[
{
"country" : "US",
"date" : "2013-01-01 00:00:00",
"hits" : [
{
"click_type" : "click"
}
]
},
{
"country" : "IL",
"date" : "2013-01-01 00:00:00",
"hits" : [
{
"click_type" : "click"
}
]
}
]
}

PUT ckdocuments/msv/2
{
"doc_creation_time" : "2013-01-01 00:00:00",
"MSV" :
[
{
"country" : "IL",
"date" : "2013-01-01 00:00:00",
"hits" : [
{
"click_type" : "pixel"
}
]
},
{
"country" : "US",
"date" : "2013-01-02 00:00:00",
"hits" : [
{
"click_type" : "click"
}
]
}
],
"views":[
{
"country" : "US",
"date" : "2013-01-01 00:00:00",
"hits" : []
},
{
"country" : "US",
"date" : "2013-01-01 00:00:00",
"hits" : [
{
"click_type" : "pixel"
},
{
"click_type" : "pixel"
}
]
},
{
"country" : "US",
"date" : "2013-01-02 00:00:00",
"hits" : [
{
"click_type" : "click"
}
]
}
]
}

PUT ckdocuments/msv/3
{
"MSV" :
[
{
"country" : "IL",
"date" : "2013-01-01 00:00:00",
"hits" : [
{
"click_type" : "click"
}
]
}
],
"views":[
{
"country" : "US",
"date" : "2013-01-01 00:00:00",
"hits" : [
{
"click_type" : "click"
}
]
},
{
"country" : "IL",
"date" : "2013-01-01 00:00:00",
"hits" : [
{
"click_type" : "click"
}
]
}
]
}

When I run:

GET /ckdocuments/msv/_search
{
"aggregations": {
"MSV":{
"aggs":{
"terms":{
"field" : "MSV.country"
}
}
}
},
"size":0
}
}

I get these results:

{
"took": 1,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 3,
"max_score": 0,
"hits": []
}
}

I just can't understand why the aggregation sperate the results to
countries..
Do you have any idea?

Thnx Niv

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/b928cd7b-042a-435d-9839-ef2bd1cc74fa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hi,

Your request is not valid, it should be

GET /ckdocuments/msv/_search
{
"aggregations": {
"MSV":{
"terms":{
"field" : "MSV.country"
}
}
},
"size":0
}
}

The next release of Elasticsearch will be less resilient to malformed
aggregations, so you will hopefully get an error instead of just getting
empty aggregations.

On Thu, May 1, 2014 at 6:37 PM, Niv Penso nivp@toonimo.com wrote:

Hey guys,

I have this mapping:

GET ckdocuments/msv/_mapping

{
"ckdocuments": {
"mappings": {
"msv": {
"properties": {
"MSV": {
"properties": {
"country": {
"type": "string",
"index": "not_analyzed"
},
"date": {
"type": "date",
"format": "YYYY-MM-dd HH:mm:ss"
},
"hits": {
"type": "nested",
"properties": {
"click_type": {
"type": "string",
"index": "not_analyzed"
}
}
}
}
},
"c": {
"type": "string",
"index": "not_analyzed"
},
"doc_creation_time": {
"type": "date",
"format": "YYYY-MM-dd HH:mm:ss"
},
"views": {
"properties": {
"country": {
"type": "string"
},
"date": {
"type": "date",
"format": "YYYY-MM-dd HH:mm:ss"
},
"hits": {
"properties": {
"click_type": {
"type": "string"
}
}
}
}
}
}
}
}
}
}

Wih these three docs:

PUT ckdocuments/msv/1
{
"c":"a",
"MSV" :
[
{
"country" : "US",
"date" : "2013-01-01 00:00:00",
"hits" : [
{
"click_type" : "click"
}
]
}
],
"views":[
{
"country" : "US",
"date" : "2013-01-01 00:00:00",
"hits" : [
{
"click_type" : "click"
}
]
},
{
"country" : "IL",
"date" : "2013-01-01 00:00:00",
"hits" : [
{
"click_type" : "click"
}
]
}
]
}

PUT ckdocuments/msv/2
{
"doc_creation_time" : "2013-01-01 00:00:00",
"MSV" :
[
{
"country" : "IL",
"date" : "2013-01-01 00:00:00",
"hits" : [
{
"click_type" : "pixel"
}
]
},
{
"country" : "US",
"date" : "2013-01-02 00:00:00",
"hits" : [
{
"click_type" : "click"
}
]
}
],
"views":[
{
"country" : "US",
"date" : "2013-01-01 00:00:00",
"hits" :
},
{
"country" : "US",
"date" : "2013-01-01 00:00:00",
"hits" : [
{
"click_type" : "pixel"
},
{
"click_type" : "pixel"
}
]
},
{
"country" : "US",
"date" : "2013-01-02 00:00:00",
"hits" : [
{
"click_type" : "click"
}
]
}
]
}

PUT ckdocuments/msv/3
{
"MSV" :
[
{
"country" : "IL",
"date" : "2013-01-01 00:00:00",
"hits" : [
{
"click_type" : "click"
}
]
}
],
"views":[
{
"country" : "US",
"date" : "2013-01-01 00:00:00",
"hits" : [
{
"click_type" : "click"
}
]
},
{
"country" : "IL",
"date" : "2013-01-01 00:00:00",
"hits" : [
{
"click_type" : "click"
}
]
}
]
}

When I run:

GET /ckdocuments/msv/_search
{
"aggregations": {
"MSV":{
"aggs":{
"terms":{
"field" : "MSV.country"
}
}
}
},
"size":0
}
}

I get these results:

{
"took": 1,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 3,
"max_score": 0,
"hits":
}
}

I just can't understand why the aggregation sperate the results to
countries..
Do you have any idea?

Thnx Niv

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/b928cd7b-042a-435d-9839-ef2bd1cc74fa%40googlegroups.comhttps://groups.google.com/d/msgid/elasticsearch/b928cd7b-042a-435d-9839-ef2bd1cc74fa%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
Adrien Grand

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j5tftHAOQ9AKZLobdrrwRHEeQV-yVEJ1Q_5aTJt29Akig%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.