2017-07-06 111 views
-2

我是EL新手,想根據「type:」:「load」搜索這些數據。基於一些字段的彈性搜索中的搜索數據

請幫

{ 
    "took": 14, 
    "timed_out": false, 
    "_shards": { 
     "total": 5, 
     "successful": 5, 
     "failed": 0 
    }, 
    "hits": { 
     "total": 1109, 
     "max_score": 1, 
     "hits": [ 
     {"_index": "4", 
      "_type": "aa", 
      "_id": "xx", 
      "_score": 1, 
      "_source": { 
       "useRange": false, 
       "Blueprint": 4, 
       "standardDeviation": 0, 
       "occurrences": 0, 
       "type:": "load", 
       }... 
       { 
       } 
+0

你有沒有嘗試什麼嗎? –

回答

0

問題是用字段名「類型」,我們將名稱更改爲typemetrics及以下的查詢工作 我的事情型可能被作爲關鍵字

" GET /4/_search 
{ 
    "query": { 
    "term" : { "typemetrics" : "load"} 
    } 
} " 
2

Elasticsearch文檔將幫助您: https://www.elastic.co/guide/en/elasticsearch/reference/current/search-search.html

編輯

查詢curl -XGET 'localhost:9200/sample/_search?q=type:load&pretty'

和輸出將被

{ 
    "took" : 1, 
    "timed_out" : false, 
    "_shards" : { 
    "total" : 5, 
    "successful" : 5, 
    "failed" : 0 
    }, 
    "hits" : { 
    "total" : 1, 
    "max_score" : 0.30685282, 
    "hits" : [ { 
     "_index" : "sample", 
     "_type" : "data", 
     "_id" : "1", 
     "_score" : 0.30685282, 
     "_source" : { 
     "useRange" : false, 
     "Blueprint" : 4, 
     "standardDeviation" : 0, 
     "occurrences" : 0, 
     "type" : "load" 
     } 
    } ] 
    } 
} 
+0

真的很感激,如果你可以在搜索類型時給予確切的查詢 – Manish

+0

:它會給你語法錯誤,刪除那個:在es索引中鍵入並存儲該記錄,並使用在答案中添加的查詢進行搜索。 –