tool.txt 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537
  1. // 新增某字段mapping
  2. curl -XPUT http://127.0.0.1:19805/projectset/_mapping -u es_all:TopJkO2E_d1x -H 'Content-Type: application/json' -d '
  3. {
  4. "properties": {
  5. "bidendtime": {
  6. "type": "long"
  7. },
  8. "list": {
  9. "properties": {
  10. "bidendtime": {
  11. "type": "long"
  12. }
  13. }
  14. }
  15. }
  16. }'
  17. // 索引添加别名
  18. curl -H 'Content-Type: application/json' -u jybid:Top2023_JEB01i@31 -XPOST http://127.0.0.1:19905/_aliases -d '
  19. {
  20. "actions": [
  21. { "add": {
  22. "alias": "bidding_pre",
  23. "index": "bidding_20231120"
  24. }}
  25. ]
  26. }'
  27. // 添加并移除别名
  28. curl -H 'Content-Type: application/json' -u es_all:TopJkO2E_d1x -XPOST http://127.0.0.1:19805/_aliases -d '
  29. {
  30. "actions": [
  31. { "remove": {
  32. "alias": "winner",
  33. "index": "winner_v1"
  34. }},
  35. { "add": {
  36. "alias": "winner",
  37. "index": "winner_v2"
  38. }}
  39. ]
  40. }'
  41. //新增某字段mapping,es7 版本
  42. curl -XPUT "http://127.0.0.1:19805/bidding_v1/_mapping" -u es_all:TopJkO2E_d1x -H 'Content-Type: application/json' -d '
  43. {
  44. "properties": {
  45. "procurementlist": {
  46. "properties": {
  47. "remark": {
  48. "type": "keyword"
  49. }
  50. }
  51. }
  52. }
  53. }'
  54. curl -XPUT "http://127.0.0.1:19805/projectset/_mapping?pretty" -u es_all:TopJkO2E_d1x -H 'Content-Type: application/json' -d '
  55. {
  56. "properties": {
  57. "review_experts": {
  58. "type": "text",
  59. "fielddata": true
  60. },
  61. "s_winner": {
  62. "type": "text",
  63. "fielddata": true,
  64. "fields": {
  65. "mwinner": {
  66. "type": "text",
  67. "analyzer": "my_ngram"
  68. }
  69. },
  70. "analyzer": "douhao"
  71. }
  72. }
  73. }'
  74. // 默认查询数量
  75. curl -XPUT "http://127.0.0.1:19805/bidding/_settings" -u es_all:TopJkO2E_d1x -H 'Content-Type: application/json' -d '
  76. {
  77. "index.max_result_window": "20000"
  78. }'
  79. //开启节点平衡
  80. curl -XPUT http://127.0.0.1:19805/bidding/_settings -u es_all:TopJkO2E_d1x -H 'content-Type:application/json' -d'{
  81. "transient" : {
  82. "cluster.routing.allocation.enable" : "all"
  83. }
  84. }'
  85. //关闭节点平衡
  86. curl -XPUT http://127.0.0.1:19805/_cluster/settings --user es_all:TopJkO2E_d1x -H 'content-Type:application/json' -d'{
  87. "transient" : {
  88. "cluster.routing.allocation.enable" : "none"
  89. }
  90. }'
  91. //开启节点平衡
  92. curl -XPUT http://127.0.0.1:19805/_cluster/settings --user es_all:TopJkO2E_d1x -H 'content-Type:application/json' -d'{
  93. "transient" : {
  94. "cluster.routing.allocation.enable" : "all"
  95. }
  96. }'
  97. //关闭节点平衡
  98. curl -XPUT http://192.168.3.206:9800/_cluster/settings -d'{
  99. "transient" : {
  100. "cluster.routing.allocation.enable" : "none"
  101. }
  102. }'
  103. //开启节点平衡,es7 环境,需要传递header参数
  104. curl -H 'Content-Type: application/json' -XPUT http://192.168.3.149:9200/_cluster/settings -d'{
  105. "transient" : {
  106. "cluster.routing.allocation.enable" : "all"
  107. }
  108. }'
  109. //关闭节点平衡
  110. curl -H 'Content-Type: application/json' -XPUT http://192.168.3.149:9200/_cluster/settings -d'{
  111. "transient" : {
  112. "cluster.routing.allocation.enable" : "none"
  113. }
  114. }'
  115. //手动移动节点
  116. curl -XPOST 'http://127.0.0.1:9800/_cluster/reroute' -d '{
  117. "commands" : [ {
  118. "move" :
  119. {
  120. "index": "qyxy_v2", "shard": 12,
  121. "from_node": "node_12", "to_node": "node_1"
  122. }
  123. }
  124. ]
  125. }'
  126. //查看节点个数
  127. curl http://localhost:9800/_settings?pretty
  128. //设置节点个数
  129. curl -XPUT 'http://127.0.0.1:9800/projectset_v1/_settings' -d '{
  130. "index.routing.allocation.total_shards_per_node":2
  131. }'
  132. // 分片异常 unsigned
  133. curl -XPOST '192.168.3.206:9800/_cluster/reroute' -d '{
  134. "commands": [{
  135. "allocate": {
  136. "index": "projectset_v1",
  137. "shard": 1,
  138. "node": "node-4",
  139. "allow_primary": 1
  140. }
  141. }]
  142. }'
  143. //新增某字段mapping
  144. curl -XPUT http://127.0.0.1:9800/bidding_v1/bidding/_mapping -d '
  145. {
  146. "properties": {
  147. "isValidFile": {
  148. "type": "boolean"
  149. }
  150. }
  151. }'
  152. curl -XPUT http://127.0.0.1:9800/bidding_v1/bidding/_mapping -d '
  153. {
  154. "properties": {
  155. "dataweight": {
  156. "type": "integer"
  157. }
  158. }
  159. }'
  160. // 恢复mapping文件
  161. curl -XPOST "http://192.168.3.128:9800/bidding/bidding/_mapping?pretty" -d '
  162. {
  163. "bidding": {
  164. "transform": {
  165. "lang": "groovy",
  166. "script": "ctx._source[\"id\"] = ctx._source[\"_id\"]"
  167. },
  168. "_id": {
  169. "path": "_id"
  170. },
  171. "_all": {
  172. "enabled": false
  173. },
  174. "properties": {
  175. "winneraddr": {
  176. "index": "not_analyzed",
  177. "type": "string"
  178. },
  179. "projectcode": {
  180. "index": "not_analyzed",
  181. "type": "string"
  182. },
  183. "channel": {
  184. "index": "not_analyzed",
  185. "type": "string"
  186. },
  187. "projectaddr": {
  188. "index": "not_analyzed",
  189. "type": "string"
  190. },
  191. "contractcode": {
  192. "index": "not_analyzed",
  193. "type": "string"
  194. },
  195. "entidlist": {
  196. "index": "not_analyzed",
  197. "type": "string"
  198. },
  199. "agencyaddr": {
  200. "index": "not_analyzed",
  201. "type": "string"
  202. },
  203. "tagname": {
  204. "analyzer": "douhao",
  205. "type": "string"
  206. },
  207. "toptype": {
  208. "index": "not_analyzed",
  209. "type": "string"
  210. },
  211. "project_duration": {
  212. "type": "long"
  213. },
  214. "bid_guarantee": {
  215. "type": "boolean"
  216. },
  217. "href": {
  218. "index": "not_analyzed",
  219. "type": "string"
  220. },
  221. "id": {
  222. "index": "not_analyzed",
  223. "type": "string"
  224. },
  225. "filetext": {
  226. "analyzer": "my_ngram",
  227. "type": "string"
  228. },
  229. "budget": {
  230. "type": "double"
  231. },
  232. "buyeraddr": {
  233. "index": "not_analyzed",
  234. "type": "string"
  235. },
  236. "area": {
  237. "index": "not_analyzed",
  238. "type": "string"
  239. },
  240. "bidamount": {
  241. "type": "double"
  242. },
  243. "projectname": {
  244. "index": "not_analyzed",
  245. "type": "string",
  246. "fields": {
  247. "pname": {
  248. "type": "string"
  249. }
  250. }
  251. },
  252. "buyertel": {
  253. "index": "not_analyzed",
  254. "type": "string"
  255. },
  256. "project_scale": {
  257. "analyzer": "my_ngram",
  258. "type": "string"
  259. },
  260. "signaturedate": {
  261. "type": "long"
  262. },
  263. "s_winner": {
  264. "analyzer": "douhao",
  265. "type": "string",
  266. "fields": {
  267. "mwinner": {
  268. "analyzer": "my_ngram_title",
  269. "type": "string"
  270. }
  271. }
  272. },
  273. "winnerorder": {
  274. "properties": {
  275. "sortstr": {
  276. "index": "not_analyzed",
  277. "type": "string"
  278. },
  279. "entname": {
  280. "index": "not_analyzed",
  281. "type": "string"
  282. },
  283. "sort": {
  284. "type": "integer"
  285. }
  286. }
  287. },
  288. "supervisorrate": {
  289. "type": "double"
  290. },
  291. "project_completedate": {
  292. "type": "long"
  293. },
  294. "buyer": {
  295. "index": "not_analyzed",
  296. "type": "string",
  297. "fields": {
  298. "mbuyer": {
  299. "analyzer": "my_ngram_title",
  300. "type": "string"
  301. }
  302. }
  303. },
  304. "winner": {
  305. "index": "not_analyzed",
  306. "type": "string"
  307. },
  308. "qualifies": {
  309. "analyzer": "my_ngram",
  310. "type": "string"
  311. },
  312. "district": {
  313. "index": "not_analyzed",
  314. "type": "string"
  315. },
  316. "publishtime": {
  317. "type": "long"
  318. },
  319. "buyerzipcode": {
  320. "index": "not_analyzed",
  321. "type": "string"
  322. },
  323. "detail": {
  324. "analyzer": "my_ngram",
  325. "type": "string"
  326. },
  327. "projectinfo": {
  328. "properties": {
  329. "approvecontent": {
  330. "analyzer": "my_ngram",
  331. "type": "string"
  332. },
  333. "approvenumber": {
  334. "index": "not_analyzed",
  335. "type": "string"
  336. },
  337. "approvecity": {
  338. "index": "not_analyzed",
  339. "type": "string"
  340. },
  341. "approvestatus": {
  342. "index": "not_analyzed",
  343. "type": "string"
  344. },
  345. "approvecode": {
  346. "index": "not_analyzed",
  347. "type": "string"
  348. },
  349. "projecttype": {
  350. "index": "not_analyzed",
  351. "type": "string"
  352. },
  353. "approvetime": {
  354. "index": "not_analyzed",
  355. "type": "string"
  356. },
  357. "approvedept": {
  358. "analyzer": "my_ngram",
  359. "type": "string"
  360. }
  361. }
  362. },
  363. "city": {
  364. "index": "not_analyzed",
  365. "type": "string"
  366. },
  367. "purchasing": {
  368. "analyzer": "my_ngram",
  369. "type": "string"
  370. },
  371. "projectscope": {
  372. "index": "not_analyzed",
  373. "type": "string",
  374. "fields": {
  375. "pscope": {
  376. "analyzer": "my_ngram",
  377. "type": "string"
  378. }
  379. }
  380. },
  381. "agencytel": {
  382. "index": "not_analyzed",
  383. "type": "string"
  384. },
  385. "project_startdate": {
  386. "type": "long"
  387. },
  388. "title": {
  389. "analyzer": "my_ngram_title",
  390. "type": "string"
  391. },
  392. "winnerperson": {
  393. "index": "not_analyzed",
  394. "type": "string"
  395. },
  396. "comeintime": {
  397. "type": "long"
  398. },
  399. "s_topscopeclass": {
  400. "analyzer": "douhao",
  401. "type": "string"
  402. },
  403. "projectperiod": {
  404. "index": "not_analyzed",
  405. "type": "string"
  406. },
  407. "project_timeunit": {
  408. "index": "not_analyzed",
  409. "type": "string"
  410. },
  411. "spidercode": {
  412. "index": "not_analyzed",
  413. "type": "string"
  414. },
  415. "subtype": {
  416. "index": "not_analyzed",
  417. "type": "string"
  418. },
  419. "infoformat": {
  420. "type": "integer"
  421. },
  422. "s_subscopeclass": {
  423. "analyzer": "douhao",
  424. "type": "string"
  425. },
  426. "agency": {
  427. "index": "not_analyzed",
  428. "type": "string",
  429. "fields": {
  430. "magency": {
  431. "analyzer": "my_ngram",
  432. "type": "string"
  433. }
  434. }
  435. },
  436. "agencyperson": {
  437. "index": "not_analyzed",
  438. "type": "string"
  439. },
  440. "bidstatus": {
  441. "index": "not_analyzed",
  442. "type": "string"
  443. },
  444. "payway": {
  445. "index": "not_analyzed",
  446. "type": "string"
  447. },
  448. "winnertel": {
  449. "index": "not_analyzed",
  450. "type": "string"
  451. },
  452. "buyerclass": {
  453. "index": "not_analyzed",
  454. "type": "string"
  455. },
  456. "contract_guarantee": {
  457. "type": "boolean"
  458. },
  459. "site": {
  460. "index": "not_analyzed",
  461. "type": "string"
  462. },
  463. "bidopentime": {
  464. "type": "long"
  465. },
  466. "topscopeclass": {
  467. "index": "not_analyzed",
  468. "type": "string"
  469. },
  470. "buyerperson": {
  471. "index": "not_analyzed",
  472. "type": "string"
  473. },
  474. "purchasinglist": {
  475. "properties": {
  476. "number": {
  477. "type": "double"
  478. },
  479. "itemname": {
  480. "index": "not_analyzed",
  481. "type": "string"
  482. },
  483. "totalprice": {
  484. "type": "double"
  485. },
  486. "unitname": {
  487. "index": "not_analyzed",
  488. "type": "string"
  489. },
  490. "model": {
  491. "analyzer": "my_ngram",
  492. "type": "string"
  493. },
  494. "brandname": {
  495. "analyzer": "my_ngram",
  496. "type": "string"
  497. },
  498. "unitprice": {
  499. "type": "double"
  500. }
  501. }
  502. }
  503. }
  504. }
  505. }'
  506. 命令:
  507. curl -XPUT 'http://127.0.0.1:9902/_cluster/settings' -u elastic:MsOCrY7Yct3sjVvB5gCd -H 'Content-Type: application/json' -d '{
  508. "persistent": {
  509. "ingest.geoip.downloader.enabled": false
  510. }
  511. }'
  512. https://discuss.elastic.co/t/unable-to-start-elasticsearch-after-upgrade-7-17-8-2-timeout-was-exceeded/310960/2
  513. 错误:
  514. [2023-05-17T16:41:14,077][ERROR][o.e.i.g.DatabaseNodeService] [es_1] failed to retrieve database [GeoLite2-Country.mmdb]
  515. org.elasticsearch.cluster.block.ClusterBlockException: blocked by: [SERVICE_UNAVAILABLE/1/state not recovered / initialized];