2012-06-03 69 views
0

這裏是我發送給ElasticSearch查詢:ElasticSearch返回所有文件

http://localhost:9200/user-index/user/_search/?queryb%5Bname%5D=Richard 

返回JSON是這樣的:

{ 
    "hits": [ 
    { 
     "_index": "user-index", 
     "_type": "user", 
     "_id": "WgrvE-DzQJminNreBIsRNA", 
     "_score": 1.0, 
     "_source": { 
     "name": "Richard", 
     "db_id": "7" 
     } 
    }, 
    { 
     "_index": "user-index", 
     "_type": "user", 
     "_id": "GwMOuYbUR8y48RrG4HgXdg", 
     "_score": 1.0, 
     "_source": { 
     "name": "John", 
     "db_id": "8" 
     } 
    }, 
    { 
     "_index": "user-index", 
     "_type": "user", 
     "_id": "C-bgK3pNTNiX9Cz0x8EftA", 
     "_score": 1.0, 
     "_source": { 
     "name": "Harold", 
     "db_id": "2" 
     } 
    } 
    ] 
} 

只有那些真正的比賽之一。爲什麼把它們全部發回來?

回答

2

Elasticsearch返回索引用戶索引中具有類型用戶的所有記錄,因爲它無法找到搜索查詢。搜索查詢應指定爲查詢字符串the parameter "q"a request body

嘗試http://localhost:9200/user-index/user/_search?q=name%3ARichard

+0

我試圖通過他們的JSON,但事實證明,在我用的是創業板的第二個參數是不是爲主體內容,但URI編碼的數據。謝謝您的幫助! – Chris

相關問題