我有彈性,我想通過查詢從彈性中獲取資料,我在索引中有大約 210 個檔案,但是當我嘗試使用查詢 match_all 進行搜索時,api 只顯示 7 個檔案而不是所有檔案,是否可以 api顯示所有檔案,而不是只顯示一些檔案。
查詢:
192.168.20.47:9200/new/_search
{
"query" : {
"match_all" : {}
}
}
彈性 API 結果:
{
"took" : 0,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 210,
"relation" : "eq"
},
"max_score" : 1.0,
"hits" : [
{
"_index" : "em-employeedata",
"_type" : "_doc",
"_id" : "202cb962ac59075b964b07152d234b70",
"_score" : 1.0,
"_source" : {
"name" : "Gani Kartiwa Adiwisastra",
"nip" : "123",
"pnid" : "81dc9bdb52d04dc20036dbd8313ed055",
"companycode" : "EBT",
"worklocationcode" : "BT",
"employee" : {
"start" : "26/11/2015",
"end" : "29/05/1453",
"status" : "P"
},
"organization" : {
"position" : "Director",
"sector" : "Direksi",
"department" : "Direksi",
"division" : "Management",
"superior" : "Director"
}
}
},
{
"_index" : "em-employeedata",
"_type" : "_doc",
"_id" : "c8ffe9a587b126f152ed3d89a146b445",
"_score" : 1.0,
"_source" : {
"name" : "Firmansyah",
"nip" : "124",
"pnid" : "9996535e07258a7bbfd8b132435c5962",
"companycode" : "EBT",
"worklocationcode" : "BT",
"employee" : {
"start" : "21/01/2014",
"end" : "29/05/1453",
"status" : "P"
},
"organization" : {
"position" : "BE Programmer",
"sector" : "MAI",
"department" : "MAI",
"division" : "MAI",
"superior" : "Be Programmer"
}
}
},
{
"_index" : "em-employeedata",
"_type" : "_doc",
"_id" : "069059b7ef840f0c74a814ec9237b6ec",
"_score" : 1.0,
"_source" : {
"name" : "Erna Tri Rahayu",
"nip" : "126",
"pnid" : "a9eb812238f753132652ae09963a05e9",
"companycode" : "EBT",
"worklocationcode" : "Sudirman",
"employee" : {
"start" : "21/01/2014",
"end" : "29/05/1453",
"status" : "P"
},
"organization" : {
"position" : "Finance Officer",
"sector" : "Finance & Accounting",
"department" : "Finance & Accounting",
"division" : "Finance & Accounting",
"superior" : "Finance Officer"
}
}
},
{
"_index" : "em-employeedata",
"_type" : "_doc",
"_id" : "ec5decca5ed3d6b8079e2e7e7bacc9f2",
"_score" : 1.0,
"_source" : {
"name" : "Sukidi",
"nip" : "127",
"pnid" : "d38901788c533e8286cb6400b40b386d",
"companycode" : "EBT",
"worklocationcode" : "Sudirman",
"employee" : {
"start" : "21/01/2014",
"end" : "29/05/1453",
"status" : "P"
},
"organization" : {
"position" : "OB",
"sector" : "GA",
"department" : "HR & GA",
"division" : "HR & GA",
"superior" : "Ob"
}
}
},
{
"_index" : "em-employeedata",
"_type" : "_doc",
"_id" : "76dc611d6ebaafc66cc0879c71b5db5c",
"_score" : 1.0,
"_source" : {
"name" : "Ni Nyoman Indah Suwardani",
"nip" : "128",
"pnid" : "b3ba8f1bee1238a2f37603d90b58898d",
"companycode" : "EBT",
"worklocationcode" : "Sudirman",
"employee" : {
"start" : "22/09/2014",
"end" : "29/05/1453",
"status" : "P"
},
"organization" : {
"position" : "Account Manager",
"sector" : "S&M Project",
"department" : "S&M Project",
"division" : "Sales & Marketing",
"superior" : "Account Manager"
}
}
},
{
"_index" : "em-employeedata",
"_type" : "_doc",
"_id" : "d1f491a404d6854880943e5c3cd9ca25",
"_score" : 1.0,
"_source" : {
"name" : "Sendhy Ferdiyanto",
"nip" : "129",
"pnid" : "a9078e8653368c9c291ae2f8b74012e7",
"companycode" : "EBT",
"worklocationcode" : "BT",
"employee" : {
"start" : "21/01/2014",
"end" : "29/05/1453",
"status" : "P"
},
"organization" : {
"position" : "Project Support",
"sector" : "Project Support",
"department" : "S&M Project",
"division" : "Sales & Marketing",
"superior" : "Project Support"
}
}
},
{
"_index" : "em-employeedata",
"_type" : "_doc",
"_id" : "9b8619251a19057cff70779273e95aa6",
"_score" : 1.0,
"_source" : {
"name" : "Hendra Pratama",
"nip" : "130",
"pnid" : "1c65cef3dfd1e00c0b03923a1c591db4",
"companycode" : "EBT",
"worklocationcode" : "BT",
"employee" : {
"start" : "21/01/2014",
"end" : "29/05/1453",
"status" : "P"
},
"organization" : {
"position" : "Project Support",
"sector" : "Project Support",
"department" : "S&M Project",
"division" : "Sales & Marketing",
"superior" : "Project Support"
}
}
},
{
"_index" : "em-employeedata",
"_type" : "_doc",
"_id" : "1afa34a7f984eeabdbb0a7d494132ee5",
"_score" : 1.0,
"_source" : {
"name" : "Detty Ayu",
"nip" : "131",
"pnid" : "2de5d16682c3c35007e4e92982f1a2ba",
"companycode" : "EBT",
"worklocationcode" : "Sudirman",
"employee" : {
"start" : "13/01/2015",
"end" : "29/05/1453",
"status" : "P"
},
"organization" : {
"position" : "Corporate Secretary",
"sector" : "PA / Sekretaris",
"department" : "PA / Sekretaris",
"division" : "Managemen",
"superior" : "Corporate Secretary"
}
}
},
{
"_index" : "em-employeedata",
"_type" : "_doc",
"_id" : "65ded5353c5ee48d0b7d48c591b8f430",
"_score" : 1.0,
"_source" : {
"name" : "Deri Alvian",
"nip" : "132",
"pnid" : "e1d5be1c7f2f456670de3d53c7b54f4a",
"companycode" : "EBT",
"worklocationcode" : "BT",
"employee" : {
"start" : "21/01/2014",
"end" : "29/05/1453",
"status" : "P"
},
"organization" : {
"position" : "Project Support",
"sector" : "Project Support",
"department" : "S&M Project",
"division" : "Sales & Marketing",
"superior" : "Project Support"
}
}
},
{
"_index" : "em-employeedata",
"_type" : "_doc",
"_id" : "9fc3d7152ba9336a670e36d0ed79bc43",
"_score" : 1.0,
"_source" : {
"name" : "Netty Purwanti",
"nip" : "133",
"pnid" : "2c89109d42178de8a367c0228f169bf8",
"companycode" : "EBT",
"worklocationcode" : "Sudirman",
"employee" : {
"start" : "04/05/2015",
"end" : "29/05/1453",
"status" : "P"
},
"organization" : {
"position" : "Account Executive Central Government",
"sector" : "S&M Central Government",
"department" : "S&M Central Government",
"division" : "Sales & Marketing",
"superior" : "Account Executive Central Government"
}
}
}
]
}
}
uj5u.com熱心網友回復:
它回傳 10 個結果(不是 7 個)。這是因為您沒有指定size
.
從檔案:
默認情況下,搜索會回傳前 10 個匹配的匹配項。要翻閱更大的結果集,您可以使用搜索 API
from
和size
引數。該from
引數定義要跳過的命中數,默認為0。該size
引數是要回傳的最大命中數。這兩個引數一起定義了一頁結果。
因此,這就是您的查詢在最大size
10,000 時的樣子:
192.168.20.47:9200/new/_search
{
"query" : {
"match_all" : {}
},
"size" : 10000
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/494009.html
標籤:javascript 弹性搜索 拿来
上一篇:無法使用函式在vue.jsetemplate上添加樣式
下一篇:物件空檢查不起作用并更改邏輯