【问题标题】:Elasticsearch term queryElasticsearch 术语查询
【发布时间】:2016-05-16 12:21:30
【问题描述】:

为什么发出下面的 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
}

【问题讨论】:

    标签: elasticsearch


    【解决方案1】:

    您需要像这样发送您的查询,它会起作用:

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

    【讨论】:

      猜你喜欢
      • 2016-05-15
      • 1970-01-01
      • 1970-01-01
      • 2019-12-06
      • 1970-01-01
      • 1970-01-01
      • 2018-11-09
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多