简体   繁体   English

Elasticsearch词条查询

[英]Elasticsearch term query

Why does issuing the Elasticsearch query below produce an error? 为什么在下面发出Elasticsearch查询会产生错误?

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

Query 询问

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

Error message 错误信息

{
  "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
}

You need to send your query like this and it will work: 您需要像这样发送查询,它将可以正常工作:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM