我有弹性,我想从弹性查询中获取数据,我在索引中有大约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"
}
}
}
]
}
}
它返回10个结果(不是7个)。这是因为您没有指定size
。
From the docs:
默认情况下,搜索返回前10个匹配命中。要浏览更大的结果集,可以使用搜索API的
from
和size
参数。from
参数定义要跳过的点击次数,默认为0。size
参数是要返回的最大命中数。这两个参数一起定义了一个页面的结果。
那么,这就是您的查询在size
最大值为10,000时的样子:
192.168.20.47:9200/new/_search
{
"query" : {
"match_all" : {}
},
"size" : 10000
}