Filter first then search

Gist below in short: I have 1000 documents, only one of them matches filter
and all of them match text query.
When I do filtered query the document is only found if I set large
max_expansions. The real data is tens of thousands documents, so it doesn't
look like a way.
Is there another way to filter documents first and then to perform search
on what was filtered?

ES 1.0.1. The queries to reproduce:

curl -XPUT 'http://localhost:9200/test_max_expansions/'

curl -XPUT 'http://localhost:9200/test_max_expansions/posts/_mapping' -d '
{
"posts" : {
"properties" : {
"title" : {"type" : "string"},
"hidden" : {"type" : "boolean"}
}
}
}'

for i in {1..1000}; do curl -XPUT "http://localhost:9200/test_max_expansions/posts/$i" -d "{"title" : "a$i", "hidden" : false}"; done

curl -XPUT 'http://localhost:9200/test_max_expansions/posts/1001' -d '
{
"title" : "a1001",
"hidden" : true
}'

curl -XGET 'http://localhost:9200/test_max_expansions/posts/_search?pretty' -d '{
"query": {
"filtered": {
"filter": { "term": { "hidden": true } },
"query": {
"match_phrase_prefix": {
"title": {
"query": "a"
}
}
}
}
}
}'

--
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/a518e17c-a349-4295-a963-597bbfb53939%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Not sure if your example data is representative of production data, but if
you have single not_analyzed term values in the field title, you can
probably use the prefix query instead.

--
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/be8be85d-5437-4c2c-9c60-5bd9ea01dc98%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Production data is ~ 10000 documents, 230 of them match filter.
I need my text queries to be analyzed, and prefix query doesn't support
that, so it won't help.

On Thursday, March 27, 2014 1:20:59 PM UTC, Binh Ly wrote:

Not sure if your example data is representative of production data, but if
you have single not_analyzed term values in the field title, you can
probably use the prefix query instead.

--
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/e74f146f-10db-4759-8abc-08b89b389e63%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

I'm also curious to know if there is way to do the opposite of
FilteredQuery... basically QueriedFilter. Filter first and then run a query
on the filtered results.

--
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/818d6e9f-b4d8-4427-b9c1-1723ac0dd5d7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.