tool.txt 11 KB

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