tool.txt 10 KB

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