I ran into the following today in Elasticsearch 1.4.4 and am trying to 
determine if this is a bug in Elasticsearch or a bug in my understanding of 
Elasticsearch. I'm more than willing to believe it is the latter. It should 
be very reproducible with the commands I've pasted.

Let's say I have two types - books and authors - and I add one of each to 
my test index:

POST /tests/authors
{ "name": "mytest12345" }

POST /tests/books
{
    "title": "My big book",
    "authors": [{ "name": "mytest12345" }]
}

I can perform a simple query and I will get both records back - one artist, 
one book:
GET /tests/_search?q=mytest12345

This is what I would expect.

If I then query against the authors.name field within the books type, I get 
my book, also just as I expect:
GET /tests/books/_search?q=authors.name:mytest12345

However, if I perform the exact same query against the root of the index 
instead of against the books type
GET /tests/_search?q=authors.name:mytest12345

I instead get back the *author* record. The book no longer comes back at 
all even though to my understanding I'm performing the same query against 
*all* types instead of just books.

If I delete the authors type (and I confirmed deleting just the authors records 
won't work)
DELETE /tests/authors

Then the query against the index root behaves as expected
GET /tests/_search?q=authors.name:mytest12345

It basically appears that the query
GET /{index}/_search?q=*{type}.{field}*:{query}

appears to run internally as:
GET /{index}/*{type}*/_search?q=*{field}*:{query}

when the {type} type exists in the index. So my question is, is this 
correct behavior that I don't understand? Or is it a bug? It feels like a 
bug to me, but I'll defer to the experts here. I'm happy to open a ticket 
if someone more experienced than me can verify it's an issue.

Thanks,

-joel

-- 
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/c8757abd-a99f-4c78-805b-17101ace7982%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to