How get only a few results ElasticSearch? -


i'm trying run query displays "indexes" appears count = 0. don't want appear count = 0.
i've tried use must_not not resolved. how do that?

my search

curl -xget 'http://127.0.0.1:9200/oknok/base_gerenciada/_search' -d '{ "from": 0,  "size": 0,  "query":{     "bool":{         "must":[{             "term":{                 "last":true              }          }]      } },  "facets": {     "filters": {         "terms": {             "field": "spec_veiculo.raw",              "all_terms": true,"size" : 999999,              "order": "term"         }     } }}' 

my result (example)

{"took":11,"timed_out":false,"_shards": {"total":5,"successful":5,"failed":0},  "hits":{"total":8375,"max_score":0.0,"hits":[]}, "facets":{"filters":      {"_type":         "terms",         "missing":0,         "total":8375,         "other":0,         "terms"[             {"term":"abril - arquitetura & construção","count":67},             {"term":"abril - aventuras na história","count":67},             {"term":"abril - bebe.com.br","count":67},             {"term":"abril - boa forma","count":67},             {"term":"abril - bons fluidos","count":67},             {"term":"abril - capricho","count":67},             {"term":"abril - casa claudia","count":67},             {"term":"abril - casa.com.br","count":67},             {"term":"abril - claudia","count":67},             {"term":"abril - contigo!","count":67},             {"term":"abril - elle","count":67},             {"term":"abril - estilo","count":67},             {"term":"abril - exame","count":67},             {"term":"abril - exame pme","count":67},             {"term":"abril - gestão escolar","count":67},             {"term":"abril - guia quatro rodas","count":67},             {"term":"abril - guia estudante","count":67},             {"term":"abril - hotel pro","count":67},             {"term":"abril - info","count":67},             {"term":"abril - manequim","count":67},             {"term":"abril - mdemulher","count":67} 

when use must_not

daniela.morais@tusk:~$ curl -xget 'http://127.0.0.1:9200/oknok/base_gerenciada/_search' -d '{"from": 0, "size": 0, "query":{"bool":{"must":[{"term":{"last":true}}]}, "must_not":[{"count":0}]}, "facets": {"filters": {"terms": {"field": "spec_veiculo.raw", "all_terms": true,"size" : 999999, "order": "term"}}}}' {"error":"searchphaseexecutionexception[failed execute phase [query], shards failed; shardfailures {[1mojvlwptwminmoky8zh3q][oknok][0]: searchparseexception[[oknok][0]: query[+last:t],from[0],size[0]: parse failure [failed parse source [{\"from\": 0, \"size\": 0, \"query\":{\"bool\":{\"must\":[{\"term\":{\"last\":true}}]}, \"must_not\":[{\"count\":0}]}, \"facets\": {\"filters\": {\"terms\": {\"field\": \"spec_veiculo.raw\", \"all_terms\": true,\"size\" : 999999, \"order\": \"term\"}}}}]]]; nested: elasticsearchparseexception[expected field name got start_array \"must_not\"]; }{[1mojvlwptwminmoky8zh3q][oknok][1]: searchparseexception[[oknok][1]: query[+last:t],from[0],size[0]: parse failure [failed parse source [{\"from\": 0, \"size\": 0, \"query\":{\"bool\":{\"must\":[{\"term\":{\"last\":true}}]}, \"must_not\":[{\"count\":0}]}, \"facets\": {\"filters\": {\"terms\": {\"field\": \"spec_veiculo.raw\", \"all_terms\": true,\"size\" : 999999, \"order\": \"term\"}}}}]]]; nested: elasticsearchparseexception[expected field name got start_array \"must_not\"]; }{[1mojvlwptwminmoky8zh3q][oknok][2]: searchparseexception[[oknok][2]: query[+last:t],from[0],size[0]: parse failure [failed parse source [{\"from\": 0, \"size\": 0, \"query\":{\"bool\":{\"must\":[{\"term\":{\"last\":true}}]}, \"must_not\":[{\"count\":0}]}, \"facets\": {\"filters\": {\"terms\": {\"field\": \"spec_veiculo.raw\", \"all_terms\": true,\"size\" : 999999, \"order\": \"term\"}}}}]]]; nested: elasticsearchparseexception[expected field name got start_array \"must_not\"]; }{[1mojvlwptwminmoky8zh3q][oknok][3]: searchparseexception[[oknok][3]: query[+last:t],from[0],size[0]: parse failure [failed parse source [{\"from\": 0, \"size\": 0, \"query\":{\"bool\":{\"must\":[{\"term\":{\"last\":true}}]}, \"must_not\":[{\"count\":0}]}, \"facets\": {\"filters\": {\"terms\": {\"field\": \"spec_veiculo.raw\", \"all_terms\": true,\"size\" : 999999, \"order\": \"term\"}}}}]]]; nested: elasticsearchparseexception[expected field name got start_array \"must_not\"]; }{[1mojvlwptwminmoky8zh3q][oknok][4]: searchparseexception[[oknok][4]: query[+last:t],from[0],size[0]: parse failure [failed parse source [{\"from\": 0, \"size\": 0, \"query\":{\"bool\":{\"must\":[{\"term\":{\"last\":true}}]}, \"must_not\":[{\"count\":0}]}, \"facets\": {\"filters\": {\"terms\": {\"field\": \"spec_veiculo.raw\", \"all_terms\": true,\"size\" : 999999, \"order\": \"term\"}}}}]]]; nested: elasticsearchparseexception[expected field name got start_array \"must_not\"]; }]","status":400} 

and can't use not filter

{                             "from": 0,                             "size": 0,                             "query": {                                 "bool": {                                     "must": [                                         {                                             "term": {                                                 "last": true                                             }                                         }                                     ]                                 }                             },                             "facets": {                                 "filters": {                                     "terms": {                                         "field": "spec_veiculo.raw",                                         "all_terms": true,                                         "size": 999999,                                         "order": "term"                                     },                                     "not": {                                         "filter" : {                                             "terms": {                                                 "count": 0                                             }                                         }                                     }                                 }                             }                         } 

try following. syntax wrong.

{    "from": 0,    "size": 0,    "query": {       "bool": {          "must": [             {                "term": {                   "last": true                }             }          ],          "must_not": [             {                "term": {                   "count": 0                }             }          ]       }    },    "facets": {       "filters": {          "terms": {             "field": "spec_veiculo.raw",             "all_terms": true,             "size": 999999,             "order": "term"          }       }    } } 

Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

android - CollapsingToolbarLayout: position the ExpandedText programmatically -

Listeners to visualise results of load test in JMeter -