我擁有超過一百萬行的數據集。我已經使用logstash與Mysql集成了elasticsearch。 當我鍵入以下URL在郵遞員來取,搜索時顯示的數據錯誤
http://localhost:9200/persondetails/Document/_search?q= *
我得到如下:
{
"took": 1,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 2,
"max_score": 1,
"hits": [
{
"_index": "persondetails",
"_type": "Document",
"_id": "%{idDocument}",
"_score": 1,
"_source": {
"iddocument": 514697,
"@timestamp": "2017-08-31T05:18:46.916Z",
"author": "vaibhav",
"expiry_date": null,
"@version": "1",
"description": "ly that",
"creation_date": null,
"type": 1
}
},
{
"_index": "persondetails",
"_type": "Document_count",
"_id": "AV4o0J3OJ5ftvuhV7i0H",
"_score": 1,
"_source": {
"query": {
"term": {
"author": "rishav"
}
}
}
}
]
}
}
它是錯誤的,因爲排在我的表數超過100萬,這表明總數只有2個。我無法找到這裏的錯誤。
當我鍵入http://localhost:9200/_cat/indices?v 這表明該
健康:黃
狀態:開放
指數:persondetails
UUID:4FiGngZcQfS0Xvu6IeHIfg
個
PRI:5
代表:1
docs.count:2
docs.deleted:1054
store.size:125.4kb
pri.store.size:125.4kb
這是我logstash.conf文件
input {
jdbc {
jdbc_connection_string => "jdbc:mysql://127.0.0.1:3306/persondetails"
jdbc_user => "root"
jdbc_password => ""
schedule => "* * * * *"
jdbc_validate_connection => true
jdbc_driver_library => "/usr/local/Cellar/logstash/5.5.2/mysql-connector-java-3.1.14/mysql-connector-java-3.1.14-bin.jar"
jdbc_driver_class => "com.mysql.jdbc.Driver"
statement => "SELECT * FROM Document"
type => "persondetails"
}
}
output {
elasticsearch {
#protocol=>http
index =>"persondetails"
document_type => "Document"
document_id => "%{idDocument}"
hosts => ["http://localhost:9200"]
stdout{ codec => rubydebug}
}
}
你從哪裏看到這個回答中的總數是1? – Val
對不起,其實2.你可以看到總數是2,但我的表中有10lac行。 –
我看到你有不同的映射類型。運行'GET http:// localhost:9200/persondetails/_search?q = *'時會得到什麼? – Val