2016-05-16 169 views
0

爲什麼在下面發佈Elasticsearch查詢會產生錯誤?Elasticsearch術語查詢

https://www.elastic.co/guide/en/elasticsearch/reference/1.4/query-dsl-terms-filter.html

查詢

curl -XGET 'localhost:9200/bizruntime/biz/_search' -d' 
{ 
    "term": { 
    "user": "prakash" 
    } 
}' 

錯誤消息

{ 
    "error": { 
    "root_cause": [ 
     { 
     "type": "search_parse_exception", 
     "reason": "failed to parse search source. unknown search element [term]", 
     "line": 3, 
     "col": 5 
     } 
    ], 
    "type": "search_phase_execution_exception", 
    "reason": "all shards failed", 
    "phase": "query", 
    "grouped": true, 
    "failed_shards": [ 
     { 
     "shard": 0, 
     "index": "bizruntime", 
     "node": "bECY7K9ORPSuLrXpL1DpDw", 
     "reason": { 
      "type": "search_parse_exception", 
      "reason": "failed to parse search source. unknown search element [term]", 
      "line": 3, 
      "col": 5 
     } 
     } 
    ] 
    }, 
    "status": 400 
} 

回答

0

您需要發送您的查詢像這樣,它會工作:

curl -XGET 'localhost:9200/bizruntime/biz/_search' -d '{ 
    "query": { 
    "term" : { "user" : "prakash" } 
    } 
}' 
+0

thanx很多..其工作 –