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+unsubscr...@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.

Reply via email to