Why the bool query dose not work with filter query?

{
"query":{
"filtered": {
"query":{
"bool":{
"must":[
{
"term":{"kind":"nps"}
}
],
"must_not":[
{
"text":{"content":"1","operator":"and"}
}
]
}
},
"filter":{
"bool":{
"must":[
{
"term":{"class":"voterlog"}
}
]
}
}
}
},
"fields":["id"],
"sort":{
"time":{"order":"desc"}
},
"size":5000
}'

{"error":"SearchPhaseExecutionException[Failed to execute phase [query], total failure; shardFailures {[mDJbHQAuSdaw403pCGOsdw][extend][0]: SearchParseException[[extend][0]: from[-1],size[-1]: Parse Failure [Failed to parse source [{"query":{"filtered":{"query":{"bool":{"must":[{"term":{"kind":"nps"}}],"must_not":[{"text":{"content":"1","operator":"and"}}]}},"filter":{"bool":{"must":[{"term":{"class":"voterlog"}}]}}}},"fields":["id"],"sort":{"time":{"order":"desc"}},"size":5000}]]]; nested: QueryParsingException[[extend] [_na] query malformed, must start with start_object]; }{[mDJbHQAuSdaw403pCGOsdw][extend][2]: SearchParseException[[extend][2]: from[-1],size[-1]: Parse Failure [Failed to parse source [{"query":{"filtered":{"query":{"bool":{"must":[{"term":{"kind":"nps"}}],"must_not":[{"text":{"content":"1","operator":"and"}}]}},"filter":{"bool":{"must":[{"term":{"class":"voterlog"}}]}}}},"fields":["id"],"sort":{"time":{"order":"desc"}},"size":5000}]]]; nested: QueryParsingException[[extend] [_na] query malformed, must start with start_object]; }{[mDJbHQAuSdaw403pCGOsdw][extend][4]: SearchParseException[[extend][4]: from[-1],size[-1]: Parse Failure [Failed to parse source [{"query":{"filtered":{"query":{"bool":{"must":[{"term":{"kind":"nps"}}],"must_not":[{"text":{"content":"1","operator":"and"}}]}},"filter":{"bool":{"must":[{"term":{"class":"voterlog"}}]}}}},"fields":["id"],"sort":{"time":{"order":"desc"}},"size":5000}]]]; nested: QueryParsingException[[extend] [_na] query malformed, must start with start_object]; }]","status":500}

why?
3ks

The problem is in the text query. It should be:

                "must_not":[ 
                    { 
                        "text":{
                            "content":{
                                "query":"1",
                                "operator":"and"
                            }
                        } 
                    } 
                ] 

On Monday, May 14, 2012 6:17:17 AM UTC-4, shinezhou wrote:

{
"query":{
"filtered": {
"query":{
"bool":{
"must":[
{
"term":{"kind":"nps"}
}
],
"must_not":[
{
"text":{"content":"1","operator":"and"}
}
]
}
},
"filter":{
"bool":{
"must":[
{
"term":{"class":"voterlog"}
}
]
}
}
}
},
"fields":["id"],
"sort":{
"time":{"order":"desc"}
},
"size":5000
}'

{"error":"SearchPhaseExecutionException[Failed to execute phase [query],
total failure; shardFailures {[mDJbHQAuSdaw403pCGOsdw][extend][0]:
SearchParseException[[extend][0]: from[-1],size[-1]: Parse Failure [Failed
to parse source
[{"query":{"filtered":{"query":{"bool":{"must":[{"term":{"kind":"nps"}}],"must_not":[{"text":{"content":"1","operator":"and"}}]}},"filter":{"bool":{"must":[{"term":{"class":"voterlog"}}]}}}},"fields":["id"],"sort":{"time":{"order":"desc"}},"size":5000}]]];

nested: QueryParsingException[[extend] [_na] query malformed, must start
with start_object]; }{[mDJbHQAuSdaw403pCGOsdw][extend][2]:
SearchParseException[[extend][2]: from[-1],size[-1]: Parse Failure [Failed
to parse source
[{"query":{"filtered":{"query":{"bool":{"must":[{"term":{"kind":"nps"}}],"must_not":[{"text":{"content":"1","operator":"and"}}]}},"filter":{"bool":{"must":[{"term":{"class":"voterlog"}}]}}}},"fields":["id"],"sort":{"time":{"order":"desc"}},"size":5000}]]];

nested: QueryParsingException[[extend] [_na] query malformed, must start
with start_object]; }{[mDJbHQAuSdaw403pCGOsdw][extend][4]:
SearchParseException[[extend][4]: from[-1],size[-1]: Parse Failure [Failed
to parse source
[{"query":{"filtered":{"query":{"bool":{"must":[{"term":{"kind":"nps"}}],"must_not":[{"text":{"content":"1","operator":"and"}}]}},"filter":{"bool":{"must":[{"term":{"class":"voterlog"}}]}}}},"fields":["id"],"sort":{"time":{"order":"desc"}},"size":5000}]]];

nested: QueryParsingException[[extend] [_na] query malformed, must start
with start_object]; }]","status":500}

why?
3ks

--
View this message in context:
http://elasticsearch-users.115913.n3.nabble.com/why-the-bool-query-dose-not-work-with-filter-query-tp3985487.html
Sent from the Elasticsearch Users mailing list archive at Nabble.com.

thanks.
i got it.