{"id":1636,"date":"2025-03-22T15:46:35","date_gmt":"2025-03-22T07:46:35","guid":{"rendered":"http:\/\/codermr.com\/?p=1636"},"modified":"2025-03-22T23:25:14","modified_gmt":"2025-03-22T15:25:14","slug":"elasticsearch%e5%b8%b8%e7%94%a8api%e6%95%b4%e7%90%86","status":"publish","type":"post","link":"http:\/\/codermr.com\/index.php\/2025\/03\/22\/elasticsearch%e5%b8%b8%e7%94%a8api%e6%95%b4%e7%90%86\/","title":{"rendered":"elasticSearch\u5e38\u7528API\u6574\u7406"},"content":{"rendered":"\n<p>\u7b2c\u4e00\u6b21\u5728\u5de5\u4f5c\u4e2d\u7528 es \u662f 2016 \u5e74\uff0c\u4e4b\u540e\u5728 2018 \u5e74\u5de5\u4f5c\u4e2d\u518d\u6b21\u7528\u5230\uff0c\u4e4b\u540e\u518d\u6ca1\u7528\u5230\u5c31\u6ca1\u600e\u4e48\u5b66\u4e60\u4f7f\u7528\uff0c\u6700\u8fd1\u6252\u4e86\u6252\u4e4b\u524d\u7684\u6280\u672f\u7b14\u8bb0\u53c8\u770b\u5230 es \uff0c\u518d\u6b21\u590d\u4e60\u8bb0\u5f55\u4e00\u4e0b\u3002<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">1. \u4f60\u597d\uff0cEs<\/h1>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"http:\/\/codermr.com\/wp-content\/uploads\/2025\/03\/image-29.png\"><img loading=\"lazy\" decoding=\"async\" width=\"925\" height=\"388\" src=\"http:\/\/codermr.com\/wp-content\/uploads\/2025\/03\/image-29.png\" alt=\"\" class=\"wp-image-1637\" srcset=\"http:\/\/codermr.com\/wp-content\/uploads\/2025\/03\/image-29.png 925w, http:\/\/codermr.com\/wp-content\/uploads\/2025\/03\/image-29-300x126.png 300w, http:\/\/codermr.com\/wp-content\/uploads\/2025\/03\/image-29-768x322.png 768w, http:\/\/codermr.com\/wp-content\/uploads\/2025\/03\/image-29-922x387.png 922w\" sizes=\"(max-width: 925px) 100vw, 925px\" \/><\/a><\/figure>\n\n\n\n<h1 class=\"wp-block-heading\">2.1_\u6d4b\u8bd5es_\u521b\u5efa\u4e00\u4e2a\u6709\u5305\u542b 2 \u4e2a\u5b57\u6bb5\u7684\u7d22\u5f15\u6587\u6863<\/h1>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"http:\/\/codermr.com\/wp-content\/uploads\/2025\/03\/image-30.png\"><img loading=\"lazy\" decoding=\"async\" width=\"693\" height=\"335\" src=\"http:\/\/codermr.com\/wp-content\/uploads\/2025\/03\/image-30.png\" alt=\"\" class=\"wp-image-1638\" srcset=\"http:\/\/codermr.com\/wp-content\/uploads\/2025\/03\/image-30.png 693w, http:\/\/codermr.com\/wp-content\/uploads\/2025\/03\/image-30-300x145.png 300w\" sizes=\"(max-width: 693px) 100vw, 693px\" \/><\/a><\/figure>\n\n\n\n<h1 class=\"wp-block-heading\">2.2_\u6d4b\u8bd5es_\u67e5\u8be2\u7d22\u5f15\u6587\u6863\u3010\u53ea\u7528\u5c06post\u6362\u6210get\u3011<\/h1>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"http:\/\/codermr.com\/wp-content\/uploads\/2025\/03\/image-32.png\"><img loading=\"lazy\" decoding=\"async\" width=\"691\" height=\"335\" src=\"http:\/\/codermr.com\/wp-content\/uploads\/2025\/03\/image-32.png\" alt=\"\" class=\"wp-image-1640\" srcset=\"http:\/\/codermr.com\/wp-content\/uploads\/2025\/03\/image-32.png 691w, http:\/\/codermr.com\/wp-content\/uploads\/2025\/03\/image-32-300x145.png 300w\" sizes=\"(max-width: 691px) 100vw, 691px\" \/><\/a><\/figure>\n\n\n\n<p>\u5982\u4e0a\uff0c\u8fd4\u56de\u7ed3\u679c\u4e2d\u7684&nbsp;<code>found<\/code>&nbsp;\u8bf4\u660e\u627e\u5230\u4e86\u8be5\u6587\u6863\uff0c<code>_source<\/code>&nbsp;\u5373\u6211\u4eec POST \u8fdb\u53bb\u7684\u539f\u59cb\u6587\u6863\u3002<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">2.3_\u6d4b\u8bd5es_\u66f4\u65b0_\u5b8c\u5168\u66ff\u6362<\/h1>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"http:\/\/codermr.com\/wp-content\/uploads\/2025\/03\/image-33.png\"><img loading=\"lazy\" decoding=\"async\" width=\"710\" height=\"346\" src=\"http:\/\/codermr.com\/wp-content\/uploads\/2025\/03\/image-33.png\" alt=\"\" class=\"wp-image-1641\" srcset=\"http:\/\/codermr.com\/wp-content\/uploads\/2025\/03\/image-33.png 710w, http:\/\/codermr.com\/wp-content\/uploads\/2025\/03\/image-33-300x146.png 300w\" sizes=\"(max-width: 710px) 100vw, 710px\" \/><\/a><\/figure>\n\n\n\n<h1 class=\"wp-block-heading\">2.4_\u6d4b\u8bd5es_\u66f4\u65b0_\u90e8\u5206\u66ff\u6362<\/h1>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"http:\/\/codermr.com\/wp-content\/uploads\/2025\/03\/image-34.png\"><img loading=\"lazy\" decoding=\"async\" width=\"699\" height=\"346\" src=\"http:\/\/codermr.com\/wp-content\/uploads\/2025\/03\/image-34.png\" alt=\"\" class=\"wp-image-1642\" srcset=\"http:\/\/codermr.com\/wp-content\/uploads\/2025\/03\/image-34.png 699w, http:\/\/codermr.com\/wp-content\/uploads\/2025\/03\/image-34-300x148.png 300w\" sizes=\"(max-width: 699px) 100vw, 699px\" \/><\/a><\/figure>\n\n\n\n<p>\u90e8\u5206\u66f4\u65b0\uff0c\u53ea\u9700\u6307\u5b9a\u8981\u66f4\u65b0\u7684\u5b57\u6bb5\u548c\u8be5\u5b57\u6bb5\u7684\u503c\u5373\u53ef\u3002\u4f46\u8981\u6ce8\u610f\u5165\u53c2\u7684json\u683c\u5f0f\u6700\u5916\u5c42\u7684 key \u662f doc \u3002<\/p>\n\n\n\n<p><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\">\u4e0d\u7ba1\u662f<strong>\u5b8c\u5168\u66f4\u65b0<\/strong>\u8fd8\u662f<strong>\u90e8\u5206\u66f4\u65b0<\/strong>\uff0c\u66f4\u65b0\u4e4b\u540e\uff0c\u6587\u6863\u4e2d\u7684 _version \u548c _seq_no \u90fd\u4f1a\u81ea\u589e\uff1a<\/mark><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"http:\/\/codermr.com\/wp-content\/uploads\/2025\/03\/image-46.png\"><img loading=\"lazy\" decoding=\"async\" width=\"474\" height=\"207\" src=\"http:\/\/codermr.com\/wp-content\/uploads\/2025\/03\/image-46.png\" alt=\"\" class=\"wp-image-1660\" srcset=\"http:\/\/codermr.com\/wp-content\/uploads\/2025\/03\/image-46.png 474w, http:\/\/codermr.com\/wp-content\/uploads\/2025\/03\/image-46-300x131.png 300w\" sizes=\"(max-width: 474px) 100vw, 474px\" \/><\/a><\/figure>\n\n\n\n<h1 class=\"wp-block-heading\">2.5_\u6d4b\u8bd5es_\u518d\u521b\u5efa\u4e00\u4e2a\u6709\u5305\u542b 2 \u4e2a\u5b57\u6bb5\u7684\u7d22\u5f15\u6587\u6863<\/h1>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"http:\/\/codermr.com\/wp-content\/uploads\/2025\/03\/image-37.png\"><img loading=\"lazy\" decoding=\"async\" width=\"693\" height=\"338\" src=\"http:\/\/codermr.com\/wp-content\/uploads\/2025\/03\/image-37.png\" alt=\"\" class=\"wp-image-1645\" srcset=\"http:\/\/codermr.com\/wp-content\/uploads\/2025\/03\/image-37.png 693w, http:\/\/codermr.com\/wp-content\/uploads\/2025\/03\/image-37-300x146.png 300w\" sizes=\"(max-width: 693px) 100vw, 693px\" \/><\/a><\/figure>\n\n\n\n<h1 class=\"wp-block-heading\">2.6_\u6d4b\u8bd5es_\u641c\u7d22\u67e5\u8be2\uff08\u901a\u8fc7\u540d\u5b57\u67e5\u8be2\uff09<\/h1>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"http:\/\/codermr.com\/wp-content\/uploads\/2025\/03\/image-38.png\"><img loading=\"lazy\" decoding=\"async\" width=\"747\" height=\"571\" src=\"http:\/\/codermr.com\/wp-content\/uploads\/2025\/03\/image-38.png\" alt=\"\" class=\"wp-image-1647\" srcset=\"http:\/\/codermr.com\/wp-content\/uploads\/2025\/03\/image-38.png 747w, http:\/\/codermr.com\/wp-content\/uploads\/2025\/03\/image-38-300x229.png 300w\" sizes=\"(max-width: 747px) 100vw, 747px\" \/><\/a><\/figure>\n\n\n\n<p>\u6211\u4eec\u60f3\u901a\u8fc7\u540d\u79f0\u6765\u8fdb\u884c\u641c\u7d22\uff0c\u53ef\u4ee5\u4f7f\u7528&nbsp;<code>_search<\/code>&nbsp;\u63a5\u53e3\uff0c\u7136\u540e\u6307\u5b9a\u6761\u4ef6&nbsp;<code>q<\/code>&nbsp;\u6765\u4f20\u9012\u67e5\u8be2\u5173\u952e\u5b57\u3002<\/p>\n\n\n\n<p><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\">\u4e0a\u9762\u8fd4\u56de\u7ed3\u679c\u4e2d\uff0c\u7b2c 10 \u884c\u7684 <code>hits<\/code>&nbsp;\u5c31\u662f\u6211\u4eec\u641c\u7d22\u8fd4\u56de\u7684\u7ed3\u679c\uff0c<code>total<\/code>&nbsp;\u662f\u641c\u7d22\u547d\u4e2d\u7684\u7ed3\u679c\u603b\u6570\uff0c\u800c 16 \u884c\u7684&nbsp;<code>hits<\/code>&nbsp;\u662f\u672c\u6b21\u8fd4\u56de\u7684\u90e8\u5206\u641c\u7d22\u7ed3\u679c\uff0c\u662f\u4e00\u4e2a\u6570\u7ec4\u7ed3\u6784\uff0c\u91cc\u9762\u662f\u5177\u4f53\u7684\u7d22\u5f15\u6587\u6863\u3002<\/mark><\/strong><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">2.7_\u6d4b\u8bd5es_\u641c\u7d22\u67e5\u8be2\uff08\u901a\u8fc7\u5e74\u9f84\u67e5\u8be2\uff09<\/h1>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"http:\/\/codermr.com\/wp-content\/uploads\/2025\/03\/image-39.png\"><img loading=\"lazy\" decoding=\"async\" width=\"709\" height=\"572\" src=\"http:\/\/codermr.com\/wp-content\/uploads\/2025\/03\/image-39.png\" alt=\"\" class=\"wp-image-1648\" srcset=\"http:\/\/codermr.com\/wp-content\/uploads\/2025\/03\/image-39.png 709w, http:\/\/codermr.com\/wp-content\/uploads\/2025\/03\/image-39-300x242.png 300w\" sizes=\"(max-width: 709px) 100vw, 709px\" \/><\/a><\/figure>\n\n\n\n<h1 class=\"wp-block-heading\">2.8_\u6d4b\u8bd5es_\u641c\u7d22\u67e5\u8be2\uff08\u9650\u5b9a\u5b57\u6bb5\u53ea\u901a\u8fc7\u5e74\u9f84\u67e5\u8be2\uff09<\/h1>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"http:\/\/codermr.com\/wp-content\/uploads\/2025\/03\/image-40.png\"><img loading=\"lazy\" decoding=\"async\" width=\"705\" height=\"571\" src=\"http:\/\/codermr.com\/wp-content\/uploads\/2025\/03\/image-40.png\" alt=\"\" class=\"wp-image-1649\" srcset=\"http:\/\/codermr.com\/wp-content\/uploads\/2025\/03\/image-40.png 705w, http:\/\/codermr.com\/wp-content\/uploads\/2025\/03\/image-40-300x243.png 300w\" sizes=\"(max-width: 705px) 100vw, 705px\" \/><\/a><\/figure>\n\n\n\n<h1 class=\"wp-block-heading\">2.9_\u6d4b\u8bd5es_\u641c\u7d22\u67e5\u8be2\uff08\u4f7f\u7528QueryDSL\u67e5\u8be2\uff09<\/h1>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"http:\/\/codermr.com\/wp-content\/uploads\/2025\/03\/image-41.png\"><img loading=\"lazy\" decoding=\"async\" width=\"705\" height=\"569\" src=\"http:\/\/codermr.com\/wp-content\/uploads\/2025\/03\/image-41.png\" alt=\"\" class=\"wp-image-1650\" srcset=\"http:\/\/codermr.com\/wp-content\/uploads\/2025\/03\/image-41.png 705w, http:\/\/codermr.com\/wp-content\/uploads\/2025\/03\/image-41-300x242.png 300w\" sizes=\"(max-width: 705px) 100vw, 705px\" \/><\/a><\/figure>\n\n\n\n<h1 class=\"wp-block-heading\">2.10_\u6d4b\u8bd5es_\u641c\u7d22\u67e5\u8be2\uff08\u805a\u5408\u67e5\u8be2\uff09<\/h1>\n\n\n\n<p><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\">\u4e0b\u56fe\u7684\u5165\u53c2\u4e2d\uff0c\u6700\u5916\u5c42\u7684&nbsp;<code>size<\/code>&nbsp;\u4e3a&nbsp;<code>0<\/code>&nbsp;\u8fd9\u6837\u53ef\u4ee5\u4e0d\u8fd4\u56de\u641c\u7d22\u547d\u4e2d\u7684\u6587\u6863\uff0c\u53ea\u8fd4\u56de\u805a\u5408\u7684\u7edf\u8ba1\u7ed3\u679c\uff0c<code>aggs<\/code>&nbsp;\u5c31\u662f\u6211\u4eec\u63cf\u8ff0\u805a\u5408\u67e5\u8be2\u8bed\u53e5\u6839\u8282\u70b9\uff0c\u6211\u4eec\u4f7f\u7528&nbsp;<code>terms<\/code>&nbsp;\u805a\u5408\u7c7b\u578b\u6765\u5bf9&nbsp;<code>age<\/code>&nbsp;\u5b57\u6bb5\u7684\u503c\u8fdb\u884c\u7edf\u8ba1\uff0c\u5e76\u4e14\u53ea\u8fd4\u56de\u524d&nbsp;<code>10<\/code>&nbsp;\u4e2a\u7edf\u8ba1\u503c\uff0c\u7136\u540e\u8fd9\u4e9b\u7edf\u8ba1\u7ed3\u679c\u6211\u4eec\u547d\u540d\u4e3a&nbsp;<code>age_stats<\/code> \uff1a<\/mark><\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"http:\/\/codermr.com\/wp-content\/uploads\/2025\/03\/image-42.png\"><img loading=\"lazy\" decoding=\"async\" width=\"770\" height=\"646\" src=\"http:\/\/codermr.com\/wp-content\/uploads\/2025\/03\/image-42.png\" alt=\"\" class=\"wp-image-1651\" srcset=\"http:\/\/codermr.com\/wp-content\/uploads\/2025\/03\/image-42.png 770w, http:\/\/codermr.com\/wp-content\/uploads\/2025\/03\/image-42-300x252.png 300w, http:\/\/codermr.com\/wp-content\/uploads\/2025\/03\/image-42-768x644.png 768w\" sizes=\"(max-width: 770px) 100vw, 770px\" \/><\/a><\/figure>\n\n\n\n<p><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\">\u5982\u4e0a\u56fe\u6240\u793a\uff0c\u53ef\u4ee5\u770b\u5230\u8fd4\u56de\u7ed3\u679c\u7684 JSON \u91cc\u9762\u5305\u542b\u4e86\u8868\u793a\u805a\u5408\u7ed3\u679c\u7684&nbsp;<code>aggregations<\/code>&nbsp;\u8282\u70b9\uff0818\u884c\uff09\uff0c\u4e0b\u9762\u6709\u6211\u4eec\u7684\u7edf\u8ba1\u7ed3\u679c&nbsp;<code>age_stats<\/code>\uff0819\u884c\uff09\uff0c\u4e0b\u9762&nbsp;<code>buckets<\/code>&nbsp;\u8868\u793a\u805a\u5408\u7684\u5177\u4f53\u503c&nbsp;<code>key<\/code>&nbsp;\u548c\u7edf\u8ba1\u6570\u636e&nbsp;<code>doc_count<\/code>\uff0c\u4e5f\u5c31\u662f\u5404\u4e2a\u5e74\u9f84\u5206\u522b\u6709\u591a\u5c11\u4e2a\u6587\u6863\uff0c\u51fa\u73b0\u4e86\u591a\u5c11\u6b21\u3002<\/mark><\/strong><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">2.11_\u6d4b\u8bd5es_\u67e5\u770b\u7d22\u5f15\u5217\u8868<\/h1>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"http:\/\/codermr.com\/wp-content\/uploads\/2025\/03\/image-43.png\"><img loading=\"lazy\" decoding=\"async\" width=\"769\" height=\"645\" src=\"http:\/\/codermr.com\/wp-content\/uploads\/2025\/03\/image-43.png\" alt=\"\" class=\"wp-image-1652\" srcset=\"http:\/\/codermr.com\/wp-content\/uploads\/2025\/03\/image-43.png 769w, http:\/\/codermr.com\/wp-content\/uploads\/2025\/03\/image-43-300x252.png 300w\" sizes=\"(max-width: 769px) 100vw, 769px\" \/><\/a><\/figure>\n\n\n\n<h1 class=\"wp-block-heading\">2.11_\u6d4b\u8bd5es_\u67e5\u770b\u7d22\u5f15\u5217\u8868<\/h1>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"http:\/\/codermr.com\/wp-content\/uploads\/2025\/03\/image-44.png\"><img loading=\"lazy\" decoding=\"async\" width=\"924\" height=\"409\" src=\"http:\/\/codermr.com\/wp-content\/uploads\/2025\/03\/image-44.png\" alt=\"\" class=\"wp-image-1653\" srcset=\"http:\/\/codermr.com\/wp-content\/uploads\/2025\/03\/image-44.png 924w, http:\/\/codermr.com\/wp-content\/uploads\/2025\/03\/image-44-300x133.png 300w, http:\/\/codermr.com\/wp-content\/uploads\/2025\/03\/image-44-768x340.png 768w, http:\/\/codermr.com\/wp-content\/uploads\/2025\/03\/image-44-922x408.png 922w\" sizes=\"(max-width: 924px) 100vw, 924px\" \/><\/a><\/figure>\n\n\n\n<p>\u8fd4\u56de\u7684\u7ed3\u679c\u4e0d\u662f JSON\uff0c\u800c\u662f\u7cbe\u7b80\u7684\u8868\u683c\u7c7b\u578b\uff0c\u7b2c\u4e00\u884c\u662f\u5b57\u6bb5\u540d\uff0c\u540e\u9762\u884c\u662f\u5177\u4f53\u7684\u6570\u636e\uff0c\u53ef\u4ee5\u770b\u5230\u7d22\u5f15\u7684\u5217\u8868\u3001\u5404\u7d22\u5f15\u72b6\u6001\u3001\u6587\u6863\u6570\u548c\u7d22\u5f15\u5927\u5c0f\u7b49\u53c2\u6570\uff0c\u5404\u5b57\u6bb5\u5206\u522b\u8bf4\u660e\u5982\u4e0b\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>\u5b57\u6bb5\u540d<\/th><th>\u8bf4\u660e<\/th><\/tr><\/thead><tbody><tr><td>health<\/td><td>&nbsp;\u7d22\u5f15\u5065\u5eb7\u72b6\u6001\uff0c<code>green<\/code>&nbsp;\u8868\u793a\u5065\u5eb7\uff1b<code>yellow<\/code>&nbsp;\u8868\u793a\u6570\u636e\u5b8c\u6574\uff0c\u4f46\u662f\u7f3a\u5c11\u526f\u672c\uff1b<code>red<\/code>&nbsp;\u5219\u8868\u793a\u6709\u6570\u636e\u635f\u574f\u3002<\/td><\/tr><tr><td>status<\/td><td>&nbsp;\u7d22\u5f15\u5de5\u4f5c\u72b6\u6001\uff0c<code>open<\/code>&nbsp;\u8868\u793a\u7d22\u5f15\u6253\u5f00\u4e2d\uff0c\u53ef\u4ee5\u88ab\u4f7f\u7528\uff1b<code>close<\/code>&nbsp;\u8868\u793a\u7d22\u5f15\u88ab\u5173\u95ed\uff0c\u4e0d\u80fd\u4f7f\u7528\u3002<\/td><\/tr><tr><td>index<\/td><td>&nbsp;\u7d22\u5f15\u540d\u79f0\u3002<\/td><\/tr><tr><td>uuid<\/td><td>&nbsp;\u7d22\u5f15\u7684\u552f\u4e00 ID \u6807\u8bc6\u3002<\/td><\/tr><tr><td>pri<\/td><td>&nbsp;\u7d22\u5f15\u7684\u4e3b\u5206\u7247\u4e2a\u6570\u3002<\/td><\/tr><tr><td>rep<\/td><td>&nbsp;\u7d22\u5f15\u7684\u526f\u672c\u5206\u7247\u4e2a\u6570\u3002<\/td><\/tr><tr><td>docs.count<\/td><td>&nbsp;\u7d22\u5f15\u5185\u7684\u6587\u6863\u4e2a\u6570\u3002<\/td><\/tr><tr><td>docs.deleted<\/td><td>&nbsp;\u7d22\u5f15\u5185\u5df2\u7ecf\u5220\u9664\u7684\u6587\u6863\u4e2a\u6570\u3002<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h1 class=\"wp-block-heading\">2.12_\u6d4b\u8bd5es_\u96c6\u7fa4\u76d1\u63a7<\/h1>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"http:\/\/codermr.com\/wp-content\/uploads\/2025\/03\/image-45.png\"><img loading=\"lazy\" decoding=\"async\" width=\"473\" height=\"502\" src=\"http:\/\/codermr.com\/wp-content\/uploads\/2025\/03\/image-45.png\" alt=\"\" class=\"wp-image-1654\" srcset=\"http:\/\/codermr.com\/wp-content\/uploads\/2025\/03\/image-45.png 473w, http:\/\/codermr.com\/wp-content\/uploads\/2025\/03\/image-45-283x300.png 283w\" sizes=\"(max-width: 473px) 100vw, 473px\" \/><\/a><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p><strong>\u672c\u6587\u53c2\u7167API \uff1a<\/strong><a href=\"https:\/\/elastic-search-in-action.medcl.com\/2.basic\/elasticsearch_quick_start\/\">https:\/\/elastic-search-in-action.medcl.com\/2.basic\/elasticsearch_quick_start\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7b2c\u4e00\u6b21\u5728\u5de5\u4f5c\u4e2d\u7528 es \u662f 2016 \u5e74\uff0c\u4e4b\u540e\u5728 2018 \u5e74\u5de5\u4f5c\u4e2d\u518d\u6b21\u7528\u5230\uff0c\u4e4b\u540e\u518d\u6ca1\u7528\u5230\u5c31\u6ca1\u600e\u4e48\u5b66\u4e60\u4f7f\u7528\uff0c\u6700&#8230;<\/p>\n","protected":false},"author":1,"featured_media":1656,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[70],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>elasticSearch\u5e38\u7528API\u6574\u7406 - \u7801\u5148\u751f\u7684\u535a\u5ba2<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/codermr.com\/index.php\/2025\/03\/22\/elasticsearch\u5e38\u7528api\u6574\u7406\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"elasticSearch\u5e38\u7528API\u6574\u7406 - \u7801\u5148\u751f\u7684\u535a\u5ba2\" \/>\n<meta property=\"og:description\" content=\"\u7b2c\u4e00\u6b21\u5728\u5de5\u4f5c\u4e2d\u7528 es \u662f 2016 \u5e74\uff0c\u4e4b\u540e\u5728 2018 \u5e74\u5de5\u4f5c\u4e2d\u518d\u6b21\u7528\u5230\uff0c\u4e4b\u540e\u518d\u6ca1\u7528\u5230\u5c31\u6ca1\u600e\u4e48\u5b66\u4e60\u4f7f\u7528\uff0c\u6700...\" \/>\n<meta property=\"og:url\" content=\"http:\/\/codermr.com\/index.php\/2025\/03\/22\/elasticsearch\u5e38\u7528api\u6574\u7406\/\" \/>\n<meta property=\"og:site_name\" content=\"\u7801\u5148\u751f\u7684\u535a\u5ba2\" \/>\n<meta property=\"article:published_time\" content=\"2025-03-22T07:46:35+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-03-22T15:25:14+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/codermr.com\/wp-content\/uploads\/2025\/03\/es2.png\" \/>\n\t<meta property=\"og:image:width\" content=\"571\" \/>\n\t<meta property=\"og:image:height\" content=\"556\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"\u7801\u5148\u751f\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/mrcode2021\" \/>\n<meta name=\"twitter:site\" content=\"@mrcode2021\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u7801\u5148\u751f\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"http:\/\/codermr.com\/index.php\/2025\/03\/22\/elasticsearch%e5%b8%b8%e7%94%a8api%e6%95%b4%e7%90%86\/#article\",\"isPartOf\":{\"@id\":\"http:\/\/codermr.com\/index.php\/2025\/03\/22\/elasticsearch%e5%b8%b8%e7%94%a8api%e6%95%b4%e7%90%86\/\"},\"author\":{\"name\":\"\u7801\u5148\u751f\",\"@id\":\"http:\/\/codermr.com\/#\/schema\/person\/39016e15c79e4f02d1ed3a64688619bf\"},\"headline\":\"elasticSearch\u5e38\u7528API\u6574\u7406\",\"datePublished\":\"2025-03-22T07:46:35+00:00\",\"dateModified\":\"2025-03-22T15:25:14+00:00\",\"mainEntityOfPage\":{\"@id\":\"http:\/\/codermr.com\/index.php\/2025\/03\/22\/elasticsearch%e5%b8%b8%e7%94%a8api%e6%95%b4%e7%90%86\/\"},\"wordCount\":94,\"commentCount\":0,\"publisher\":{\"@id\":\"http:\/\/codermr.com\/#\/schema\/person\/39016e15c79e4f02d1ed3a64688619bf\"},\"keywords\":[\"elasticsearch\"],\"articleSection\":[\"JAVA\"],\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"http:\/\/codermr.com\/index.php\/2025\/03\/22\/elasticsearch%e5%b8%b8%e7%94%a8api%e6%95%b4%e7%90%86\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"http:\/\/codermr.com\/index.php\/2025\/03\/22\/elasticsearch%e5%b8%b8%e7%94%a8api%e6%95%b4%e7%90%86\/\",\"url\":\"http:\/\/codermr.com\/index.php\/2025\/03\/22\/elasticsearch%e5%b8%b8%e7%94%a8api%e6%95%b4%e7%90%86\/\",\"name\":\"elasticSearch\u5e38\u7528API\u6574\u7406 - \u7801\u5148\u751f\u7684\u535a\u5ba2\",\"isPartOf\":{\"@id\":\"http:\/\/codermr.com\/#website\"},\"datePublished\":\"2025-03-22T07:46:35+00:00\",\"dateModified\":\"2025-03-22T15:25:14+00:00\",\"breadcrumb\":{\"@id\":\"http:\/\/codermr.com\/index.php\/2025\/03\/22\/elasticsearch%e5%b8%b8%e7%94%a8api%e6%95%b4%e7%90%86\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/codermr.com\/index.php\/2025\/03\/22\/elasticsearch%e5%b8%b8%e7%94%a8api%e6%95%b4%e7%90%86\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\/\/codermr.com\/index.php\/2025\/03\/22\/elasticsearch%e5%b8%b8%e7%94%a8api%e6%95%b4%e7%90%86\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"http:\/\/codermr.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"elasticSearch\u5e38\u7528API\u6574\u7406\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\/\/codermr.com\/#website\",\"url\":\"http:\/\/codermr.com\/\",\"name\":\"\u7801\u5148\u751f\u7684\u535a\u5ba2\",\"description\":\"\u6b22 \u8fce \u4e0b \u8f7d \u6211 \u5f00 \u53d1 \u7684 \u5404 \u7aef \u8f6f \u4ef6 \u548c APP\",\"publisher\":{\"@id\":\"http:\/\/codermr.com\/#\/schema\/person\/39016e15c79e4f02d1ed3a64688619bf\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\/\/codermr.com\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"http:\/\/codermr.com\/#\/schema\/person\/39016e15c79e4f02d1ed3a64688619bf\",\"name\":\"\u7801\u5148\u751f\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"http:\/\/codermr.com\/#\/schema\/person\/image\/\",\"url\":\"http:\/\/codermr.com\/wp-content\/uploads\/2023\/02\/wukong.jpg\",\"contentUrl\":\"http:\/\/codermr.com\/wp-content\/uploads\/2023\/02\/wukong.jpg\",\"width\":400,\"height\":400,\"caption\":\"\u7801\u5148\u751f\"},\"logo\":{\"@id\":\"http:\/\/codermr.com\/#\/schema\/person\/image\/\"},\"sameAs\":[\"http:\/\/codermr.com\",\"https:\/\/twitter.com\/https:\/\/twitter.com\/mrcode2021\"],\"url\":\"http:\/\/codermr.com\/index.php\/author\/coderma\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"elasticSearch\u5e38\u7528API\u6574\u7406 - \u7801\u5148\u751f\u7684\u535a\u5ba2","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"http:\/\/codermr.com\/index.php\/2025\/03\/22\/elasticsearch\u5e38\u7528api\u6574\u7406\/","og_locale":"zh_CN","og_type":"article","og_title":"elasticSearch\u5e38\u7528API\u6574\u7406 - \u7801\u5148\u751f\u7684\u535a\u5ba2","og_description":"\u7b2c\u4e00\u6b21\u5728\u5de5\u4f5c\u4e2d\u7528 es \u662f 2016 \u5e74\uff0c\u4e4b\u540e\u5728 2018 \u5e74\u5de5\u4f5c\u4e2d\u518d\u6b21\u7528\u5230\uff0c\u4e4b\u540e\u518d\u6ca1\u7528\u5230\u5c31\u6ca1\u600e\u4e48\u5b66\u4e60\u4f7f\u7528\uff0c\u6700...","og_url":"http:\/\/codermr.com\/index.php\/2025\/03\/22\/elasticsearch\u5e38\u7528api\u6574\u7406\/","og_site_name":"\u7801\u5148\u751f\u7684\u535a\u5ba2","article_published_time":"2025-03-22T07:46:35+00:00","article_modified_time":"2025-03-22T15:25:14+00:00","og_image":[{"width":571,"height":556,"url":"http:\/\/codermr.com\/wp-content\/uploads\/2025\/03\/es2.png","type":"image\/png"}],"author":"\u7801\u5148\u751f","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/mrcode2021","twitter_site":"@mrcode2021","twitter_misc":{"\u4f5c\u8005":"\u7801\u5148\u751f","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"4 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"http:\/\/codermr.com\/index.php\/2025\/03\/22\/elasticsearch%e5%b8%b8%e7%94%a8api%e6%95%b4%e7%90%86\/#article","isPartOf":{"@id":"http:\/\/codermr.com\/index.php\/2025\/03\/22\/elasticsearch%e5%b8%b8%e7%94%a8api%e6%95%b4%e7%90%86\/"},"author":{"name":"\u7801\u5148\u751f","@id":"http:\/\/codermr.com\/#\/schema\/person\/39016e15c79e4f02d1ed3a64688619bf"},"headline":"elasticSearch\u5e38\u7528API\u6574\u7406","datePublished":"2025-03-22T07:46:35+00:00","dateModified":"2025-03-22T15:25:14+00:00","mainEntityOfPage":{"@id":"http:\/\/codermr.com\/index.php\/2025\/03\/22\/elasticsearch%e5%b8%b8%e7%94%a8api%e6%95%b4%e7%90%86\/"},"wordCount":94,"commentCount":0,"publisher":{"@id":"http:\/\/codermr.com\/#\/schema\/person\/39016e15c79e4f02d1ed3a64688619bf"},"keywords":["elasticsearch"],"articleSection":["JAVA"],"inLanguage":"zh-Hans","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["http:\/\/codermr.com\/index.php\/2025\/03\/22\/elasticsearch%e5%b8%b8%e7%94%a8api%e6%95%b4%e7%90%86\/#respond"]}]},{"@type":"WebPage","@id":"http:\/\/codermr.com\/index.php\/2025\/03\/22\/elasticsearch%e5%b8%b8%e7%94%a8api%e6%95%b4%e7%90%86\/","url":"http:\/\/codermr.com\/index.php\/2025\/03\/22\/elasticsearch%e5%b8%b8%e7%94%a8api%e6%95%b4%e7%90%86\/","name":"elasticSearch\u5e38\u7528API\u6574\u7406 - \u7801\u5148\u751f\u7684\u535a\u5ba2","isPartOf":{"@id":"http:\/\/codermr.com\/#website"},"datePublished":"2025-03-22T07:46:35+00:00","dateModified":"2025-03-22T15:25:14+00:00","breadcrumb":{"@id":"http:\/\/codermr.com\/index.php\/2025\/03\/22\/elasticsearch%e5%b8%b8%e7%94%a8api%e6%95%b4%e7%90%86\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["http:\/\/codermr.com\/index.php\/2025\/03\/22\/elasticsearch%e5%b8%b8%e7%94%a8api%e6%95%b4%e7%90%86\/"]}]},{"@type":"BreadcrumbList","@id":"http:\/\/codermr.com\/index.php\/2025\/03\/22\/elasticsearch%e5%b8%b8%e7%94%a8api%e6%95%b4%e7%90%86\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"http:\/\/codermr.com\/"},{"@type":"ListItem","position":2,"name":"elasticSearch\u5e38\u7528API\u6574\u7406"}]},{"@type":"WebSite","@id":"http:\/\/codermr.com\/#website","url":"http:\/\/codermr.com\/","name":"\u7801\u5148\u751f\u7684\u535a\u5ba2","description":"\u6b22 \u8fce \u4e0b \u8f7d \u6211 \u5f00 \u53d1 \u7684 \u5404 \u7aef \u8f6f \u4ef6 \u548c APP","publisher":{"@id":"http:\/\/codermr.com\/#\/schema\/person\/39016e15c79e4f02d1ed3a64688619bf"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/codermr.com\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":["Person","Organization"],"@id":"http:\/\/codermr.com\/#\/schema\/person\/39016e15c79e4f02d1ed3a64688619bf","name":"\u7801\u5148\u751f","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"http:\/\/codermr.com\/#\/schema\/person\/image\/","url":"http:\/\/codermr.com\/wp-content\/uploads\/2023\/02\/wukong.jpg","contentUrl":"http:\/\/codermr.com\/wp-content\/uploads\/2023\/02\/wukong.jpg","width":400,"height":400,"caption":"\u7801\u5148\u751f"},"logo":{"@id":"http:\/\/codermr.com\/#\/schema\/person\/image\/"},"sameAs":["http:\/\/codermr.com","https:\/\/twitter.com\/https:\/\/twitter.com\/mrcode2021"],"url":"http:\/\/codermr.com\/index.php\/author\/coderma\/"}]}},"_links":{"self":[{"href":"http:\/\/codermr.com\/index.php\/wp-json\/wp\/v2\/posts\/1636"}],"collection":[{"href":"http:\/\/codermr.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/codermr.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/codermr.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/codermr.com\/index.php\/wp-json\/wp\/v2\/comments?post=1636"}],"version-history":[{"count":7,"href":"http:\/\/codermr.com\/index.php\/wp-json\/wp\/v2\/posts\/1636\/revisions"}],"predecessor-version":[{"id":1663,"href":"http:\/\/codermr.com\/index.php\/wp-json\/wp\/v2\/posts\/1636\/revisions\/1663"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/codermr.com\/index.php\/wp-json\/wp\/v2\/media\/1656"}],"wp:attachment":[{"href":"http:\/\/codermr.com\/index.php\/wp-json\/wp\/v2\/media?parent=1636"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/codermr.com\/index.php\/wp-json\/wp\/v2\/categories?post=1636"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/codermr.com\/index.php\/wp-json\/wp\/v2\/tags?post=1636"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}