Terms facet/agg not working for nested types in 1.x


(asanderson) #1

I'm running Elasticsearch 1.0.1 with 1 node, 1 shard, 0 replicas for this
test.

My $ES_HOME/config/default-mapping.json is the following:
{
"default": {
"properties": {
"foo": {
"type": "nested",
"properties": {
"bar": {
"index": "analyzed",
"type": "string"
}
}
}
}
}
}

I add the following doc to test/foobar:
{
"foo": {
"bar": "Foo Bar"
}
}

When I POST the following facet (and similar agg):
{
"facets": {
"foobar": {
"terms": {
"field": "foo.bar"
}
}
},
"size": 0
}

I get the following results:
{
took: 52,
timed_out: false,
_shards: {
total: 1,
successful: 1,
failed: 0
},
hits: {
total: 1,
max_score: 0,
hits: []
},
facets: {
foo: {
_type: "terms",
missing: 1,
total: 0,
other: 0
terms: []
}
}
}

However, the similar setup/facet query worked in 0.90.7.

Please advise if this no longer works in 1.0.1 or if I'm doing something
wrong.

--
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/3f3dfe39-99d6-419c-a4d0-c6e0d95a6e93%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Binh Ly-2) #2

Try:

{
"default": {
"properties": {
"foo": {
"type": "nested",

  •        "include_in_parent": true,*
          "properties": {
             "bar": {
                "index": "analyzed",
                "type": "string"
             }
          }
       }
    }
    
    }
    }

It's interesting that it worked in the previous version (I didn't expect it
to). But the above should work in 1.x.

--
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/450f2132-43cc-4adf-8580-1b190bf2ed4b%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(asanderson) #3

That worked!

After further review, I did in fact have that in my 0.90.7 config, but it
got lost in translation to my 1.0.1 config.

MANY THANKS!!

On Thursday, February 27, 2014 6:03:59 PM UTC-5, Binh Ly wrote:

Try:

{
"default": {
"properties": {
"foo": {
"type": "nested",

  •        "include_in_parent": true,*
          "properties": {
             "bar": {
                "index": "analyzed",
                "type": "string"
             }
          }
       }
    }
    
    }
    }

It's interesting that it worked in the previous version (I didn't expect
it to). But the above should work in 1.x.

--
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/f4c796a7-83db-4c3e-91c7-cc1286d37150%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #4