下面是一些最近在做搜索引擎时,写的dsl语句,备忘!

    1. GET tjecommodity-20220118/_search
    2. {
    3. "from": 0,
    4. "size": 16,
    5. "query": {
    6. "match": {
    7. "names": "水"
    8. }
    9. },
    10. "_source": {
    11. "includes": [],
    12. "excludes": [
    13. "introduces",
    14. "imagelist",
    15. "tFilteritems",
    16. "creationtime",
    17. "tFilteritems"
    18. ]
    19. }
    20. }
    21. #根据条件批量删除
    22. POST /tjecommodity-20220118/_delete_by_query
    23. {
    24. "query": {
    25. "term": {
    26. "supplierid": {
    27. "value": "23"
    28. }
    29. }
    30. }
    31. }
    32. #根据供应商id查询
    33. GET tjecommodity-20220118/_search
    34. {
    35. "query": {
    36. "term": {
    37. "supplierid": {
    38. "value": "23"
    39. }
    40. }
    41. }
    42. }
    43. #根据绝对条件批量删除
    44. POST /recommended-20220117/_delete_by_query
    45. {
    46. "query": {
    47. "term": {
    48. "recommended": {
    49. "value": "污水泵"
    50. }
    51. }
    52. },"size": 20
    53. }
    54. #推荐词聚合查询
    55. GET /recommended-20220117/_search
    56. {
    57. "query": {
    58. "term": {
    59. "recommended": "净水器"
    60. }
    61. },
    62. "size": 50
    63. }
    64. #删除指定索引下的指定id文档
    65. DELETE recommended-20220117/_doc/jCYRUn4B7e8zdJt45-34
    66. #更新搜索范文大小
    67. PUT recommended-20220117/_settings
    68. {
    69. "index.max_result_window":10000000
    70. }
    71. #更新分词
    72. POST tjecommodity-*/_update_by_query
    73. {
    74. "conflicts":"proceed"
    75. }
    76. #添加搜索关键词
    77. POST /recommended-20220117/_doc
    78. {
    79. "recommended": "鸡蛋面"
    80. }
    81. #最大细度分词
    82. GET _analyze
    83. {
    84. "analyzer": "ik_max_word",
    85. "text": "鸡蛋面"
    86. }
    87. #推荐词聚合查询
    88. GET /recommended-20220117/_search
    89. {
    90. "query": {
    91. "match": {
    92. "recommended": "面"
    93. }
    94. },
    95. "size": 200,
    96. "aggs": {
    97. "NAME": {
    98. "terms": {
    99. "field": "recommended.keyword",
    100. "size": 50
    101. }
    102. }
    103. }
    104. }
    105. #搜索关键字
    106. GET /recommended-20220112/_search
    107. {
    108. "query": {
    109. "match": {
    110. "recommended": "方便面"
    111. }
    112. }
    113. }
    114. #根据商品id搜索
    115. GET /tjecommodity-20220118/_search
    116. {
    117. "_source": {
    118. "excludes": ["imagelist","introduces"]
    119. },
    120. "query": {
    121. "term": {
    122. "id": {
    123. "value": 4704546776
    124. }
    125. }
    126. }
    127. }
    128. #获取指定索引的指定文档
    129. GET recommended-20220112/_doc/ZRxQTH4B7e8zdJt4OqC3
    130. #获取指定所以的mapping
    131. GET /recommended-20220112/_mapping
    132. #多条件并列搜索
    133. GET tjecommodity/_search
    134. {
    135. "from": 0,
    136. "size": 20,
    137. "query": {
    138. "bool": {
    139. "should": [
    140. {
    141. "match": {
    142. "brandname": {
    143. "query": "口罩",
    144. "operator": "AND",
    145. "prefix_length": 0,
    146. "max_expansions": 50,
    147. "fuzzy_transpositions": true,
    148. "lenient": false,
    149. "zero_terms_query": "NONE",
    150. "auto_generate_synonyms_phrase_query": true,
    151. "boost": 1
    152. }
    153. }
    154. },
    155. {
    156. "match": {
    157. "names": {
    158. "query": "口罩",
    159. "operator": "AND",
    160. "prefix_length": 0,
    161. "max_expansions": 50,
    162. "fuzzy_transpositions": true,
    163. "lenient": false,
    164. "zero_terms_query": "NONE",
    165. "auto_generate_synonyms_phrase_query": true,
    166. "boost": 3
    167. }
    168. }
    169. }
    170. ],
    171. "adjust_pure_negative": true,
    172. "boost": 1
    173. }
    174. },
    175. "_source": {
    176. "includes": [],
    177. "excludes": [
    178. "introduces",
    179. "imagelist",
    180. "tFilteritems",
    181. "creationtime",
    182. "tFilteritems"
    183. ]
    184. }
    185. }
    186. #分词测试
    187. GET _analyze
    188. {
    189. "analyzer": "ik_max_word",
    190. "text": "方便面"
    191. }
    192. #删除指定索引
    193. DELETE recommended-20220117
    194. #设置搜索推荐关键词的mapping
    195. PUT /recommended-20220117/?pretty
    196. {
    197. "settings": {
    198. "number_of_shards": 5,
    199. "number_of_replicas": 2
    200. },"mappings": {
    201. "properties" : {
    202. "recommended" : {
    203. "type" : "text",
    204. "fields" : {
    205. "keyword" : {
    206. "type" : "keyword",
    207. "ignore_above" : 256
    208. }
    209. },"analyzer": "ik_max_word"
    210. }
    211. }
    212. }
    213. }
    214. GET tjecommodity/_search
    215. {
    216. "from": 0,
    217. "size": 20,
    218. "query": {
    219. "bool": {
    220. "must": [
    221. {
    222. "match": {
    223. "extension_field": {
    224. "query": "防疫物资",
    225. "operator": "OR",
    226. "prefix_length": 0,
    227. "max_expansions": 50,
    228. "fuzzy_transpositions": true,
    229. "lenient": false,
    230. "zero_terms_query": "NONE",
    231. "auto_generate_synonyms_phrase_query": true,
    232. "boost": 1
    233. }
    234. }
    235. }
    236. ],
    237. "adjust_pure_negative": true,
    238. "boost": 1
    239. }
    240. },
    241. "_source": {
    242. "includes": [],
    243. "excludes": [
    244. "introduces",
    245. "imagelist",
    246. "tFilteritems",
    247. "creationtime"
    248. ]
    249. }
    250. }
    251. #通过供应商id进行搜索后进入店铺页面
    252. GET commodity/_search
    253. {
    254. "from": 0,
    255. "size": 16,
    256. "query": {
    257. "bool": {
    258. "must": [
    259. {
    260. "term": {
    261. "supplierid": {
    262. "value": 34,
    263. "boost": 1
    264. }
    265. }
    266. }
    267. ],
    268. "adjust_pure_negative": true,
    269. "boost": 1
    270. }
    271. },
    272. "_source": {
    273. "includes": [],
    274. "excludes": [
    275. "introduces",
    276. "imagelist",
    277. "tFilteritems",
    278. "creationtime",
    279. "tFilteritems"
    280. ]
    281. }
    282. }
    283. POST _analyze
    284. {
    285. "text": "齐心 11孔文件保护套 A4 透明色 100个装 EH303A-1 13W8740『固安捷』",
    286. "analyzer": "ngram_analyzer"
    287. }
    288. POST _analyze
    289. {
    290. "tokenizer": "ngram",
    291. "text": "齐心 11孔文件保护套 A4 透明色 100个装 EH303A-1 13W8740『固安捷』"
    292. }
    293. GET /tjecommodity-20220110/_search
    294. {
    295. "_source": {
    296. "includes": ["names"]
    297. },
    298. "suggest": {
    299. "YOUR_SUGGESTION": {
    300. "text": "齐心",
    301. "phrase": {
    302. "field": "names",
    303. "size": 10
    304. }
    305. }
    306. }
    307. }
    308. GET /tjecommodity/_search
    309. {
    310. "query": {
    311. "term": {
    312. "status": {
    313. "value": 1
    314. }
    315. }
    316. }
    317. }
    318. #更新分词
    319. POST commodity/_update_by_query
    320. {
    321. "conflicts":"proceed"
    322. }
    323. GET /tjecommodity/_search
    324. {"from":0,"size":10,"query":{"bool":{"must":[{"term":{"top":{"value":0,"boost":1.0}}},{"match":{"extension_field":{"query":"年货","operator":"OR","prefix_length":0,"max_expansions":50,"fuzzy_transpositions":true,"lenient":false,"zero_terms_query":"NONE","auto_generate_synonyms_phrase_query":true,"boost":1.0}}}],"adjust_pure_negative":true,"boost":1.0}},"_source":{"includes":[],"excludes":["introduces","imagelist","tFilteritems","creationtime","tFilteritems"]}}
    325. #过滤并不展示指定字段后进行搜索查询
    326. GET tjecommodity/_search
    327. {
    328. "_source": {
    329. "includes": [],
    330. "excludes": [
    331. "introduces",
    332. "imagelist",
    333. "tFilteritems",
    334. "creationtime",
    335. "tFilteritems"
    336. ]
    337. },
    338. "query": {
    339. "bool": {
    340. "must": [
    341. {
    342. "term": {
    343. "oneid": {
    344. "value": 14468
    345. }
    346. }
    347. }
    348. ]
    349. }
    350. },
    351. "size": 20
    352. }
    353. #多条件 多字段排序搜索
    354. GET tjecommodity/_search
    355. {
    356. "from": 0,
    357. "size": 16,
    358. "query": {
    359. "bool": {
    360. "should": [
    361. {
    362. "match": {
    363. "names": {
    364. "query": "TM2490",
    365. "operator": "AND",
    366. "prefix_length": 0,
    367. "max_expansions": 50,
    368. "fuzzy_transpositions": true,
    369. "lenient": false,
    370. "zero_terms_query": "NONE",
    371. "auto_generate_synonyms_phrase_query": true,
    372. "boost": 3
    373. }
    374. }
    375. },
    376. {
    377. "match": {
    378. "brandname": {
    379. "query": "TM2490",
    380. "operator": "AND",
    381. "prefix_length": 0,
    382. "max_expansions": 50,
    383. "fuzzy_transpositions": true,
    384. "lenient": false,
    385. "zero_terms_query": "NONE",
    386. "auto_generate_synonyms_phrase_query": true,
    387. "boost": 2
    388. }
    389. }
    390. },
    391. {
    392. "match": {
    393. "number": {
    394. "query": "TM2490",
    395. "operator": "AND",
    396. "prefix_length": 0,
    397. "max_expansions": 50,
    398. "fuzzy_transpositions": true,
    399. "lenient": false,
    400. "zero_terms_query": "NONE",
    401. "auto_generate_synonyms_phrase_query": true,
    402. "boost": 2
    403. }
    404. }
    405. }
    406. ],
    407. "adjust_pure_negative": true,
    408. "boost": 1
    409. }
    410. },
    411. "_source": {
    412. "includes": [],
    413. "excludes": [
    414. "introduces",
    415. "imagelist",
    416. "tFilteritems",
    417. "creationtime"
    418. ]
    419. },
    420. "sort": [
    421. {
    422. "tSpecifications.discount": {
    423. "order": "desc"
    424. }
    425. },
    426. {
    427. "personSort": {
    428. "order": "asc"
    429. }
    430. }
    431. ],
    432. "track_total_hits": 2147483647,
    433. "highlight": {
    434. "pre_tags": [
    435. "<font color='red'>"
    436. ],
    437. "post_tags": [
    438. "</font>"
    439. ]
    440. }
    441. }
    442. GET commodity/_search
    443. {
    444. "query": {
    445. "multi_match": {
    446. "query": "齐心",
    447. "type": "best_fields",
    448. "fields": ["brandname","names"]
    449. }
    450. }
    451. }
    452. GET /house-*/_search
    453. {
    454. "query": {
    455. "multi_match": {
    456. "query": "天齐",
    457. "fields": ["brandname","names","supplieridname"]
    458. }
    459. }
    460. }
    461. GET /test20220104/_search
    462. { "_source" : {
    463. "excludes": [ "introduces","imagelist","tFilteritems","creationtime","tSpecifications.creationtime" ]
    464. },
    465. "query": {
    466. "term": {
    467. "brandname.keyword": "悦才智连"
    468. }
    469. }
    470. }
    471. POST /tjecommodity/_doc
    472. {
    473. "properties":{
    474. "extension_field":{
    475. "type":"text",
    476. "fielddata":true
    477. }
    478. }
    479. }
    480. GET /commodity/_doc/10-AA5666360
    481. GET /commodity/_search/
    482. {
    483. "_source": {
    484. "includes": [],
    485. "excludes": [
    486. "introduces",
    487. "imagelist",
    488. "tFilteritems",
    489. "creationtime",
    490. "tSpecifications",
    491. "filteritem",
    492. "tFilteritems"
    493. ]
    494. },
    495. "aggregations": {
    496. "hot": {
    497. "sum": {
    498. "field": "extension_field.keyword"
    499. }
    500. }
    501. }
    502. }
    503. GET /commodity/_search/
    504. {"_source" : {
    505. "excludes": [ "introduces","imagelist","tFilteritems","creationtime","tSpecifications.creationtime" ]
    506. },
    507. "aggs": {
    508. "NsssAME": {
    509. "terms": {
    510. "field": "properties.extension_field.fielddata"
    511. }
    512. }
    513. }
    514. }
    515. GET /commodity/_search/
    516. {
    517. "_source" : {
    518. "excludes": [ "introduces","imagelist","tFilteritems","creationtime","tSpecifications.creationtime" ]
    519. },
    520. "aggs": {
    521. "street_values": {
    522. "terms": {
    523. "field": "extension_field.keyword",
    524. "size": 10
    525. }
    526. }
    527. }
    528. }
    529. GET /tjecommodity/_search/
    530. {"_source" : {
    531. "excludes": [ "introduces","imagelist","tFilteritems","creationtime","tSpecifications.creationtime" ]
    532. },
    533. "query": {
    534. "match": {
    535. "extension_field": "年货"
    536. }
    537. }
    538. }
    539. GET /commodity/_search
    540. {
    541. "from": 10,
    542. "size": 0,
    543. "query": {
    544. "bool": {
    545. "should": [{
    546. "bool": {
    547. "must": [{
    548. "match": {
    549. "names": "齐心"
    550. }
    551. }, {
    552. "match": {
    553. "brandname.":
    554. "齐心"
    555. }
    556. }],
    557. "adjust_pure_negative": true,
    558. "boost": 1.0
    559. }
    560. }],
    561. "adjust_pure_negative": true,
    562. "boost": 1.0
    563. }
    564. }
    565. }
    566. GET /tjecommodity/_search
    567. DELETE tjecommodity
    568. GET /tjecommodity/_search
    569. {
    570. "_source": {
    571. "excludes": [
    572. "introduces",
    573. "imagelist",
    574. "tFilteritems",
    575. "creationtime",
    576. "tSpecifications.creationtime"
    577. ]
    578. },
    579. "query": {
    580. "term": {
    581. "brandname": "齐心"
    582. }
    583. }
    584. }
    585. GET /test20220104/_search
    586. {
    587. "query": {
    588. "term": {
    589. "brandname": {
    590. "value": "悦才智连"
    591. }
    592. }
    593. }
    594. }
    595. GET /commodity/_search/
    596. {"from":0,"size":10,"query":{"bool":{"must":[{"term":{"top":{"value":0,"boost":1.0}}}],"adjust_pure_negative":true,"boost":1.0}}}
    597. GET /_cluster/health
    598. GET /_cat/health
    599. GET /test20220104/_search/
    600. GET /test20220104/_search?q=悦才智连
    601. ##获取索引
    602. GET /_cat/indices
    603. ##获取索引mapping
    604. GET /commodity/_mapping
    605. GET tjecommodity/_search
    606. {
    607. "from": 0,
    608. "size": 16,
    609. "query": {
    610. "bool": {
    611. "should": [
    612. {
    613. "match": {
    614. "names": {
    615. "query": "桶装水",
    616. "operator": "AND",
    617. "prefix_length": 0,
    618. "max_expansions": 50,
    619. "fuzzy_transpositions": true,
    620. "lenient": false,
    621. "zero_terms_query": "NONE",
    622. "auto_generate_synonyms_phrase_query": true,
    623. "boost": 10
    624. }
    625. }
    626. },
    627. {
    628. "match": {
    629. "extension_field": {
    630. "query": "桶装水",
    631. "operator": "AND",
    632. "prefix_length": 0,
    633. "max_expansions": 50,
    634. "fuzzy_transpositions": true,
    635. "lenient": false,
    636. "zero_terms_query": "NONE",
    637. "auto_generate_synonyms_phrase_query": true,
    638. "boost": 20
    639. }
    640. }
    641. },
    642. {
    643. "match": {
    644. "brandname": {
    645. "query": "桶装水",
    646. "operator": "AND",
    647. "prefix_length": 0,
    648. "max_expansions": 50,
    649. "fuzzy_transpositions": true,
    650. "lenient": false,
    651. "zero_terms_query": "NONE",
    652. "auto_generate_synonyms_phrase_query": true,
    653. "boost": 5
    654. }
    655. }
    656. },
    657. {
    658. "match": {
    659. "oneName": {
    660. "query": "桶装水",
    661. "operator": "AND",
    662. "prefix_length": 0,
    663. "max_expansions": 50,
    664. "fuzzy_transpositions": true,
    665. "lenient": false,
    666. "zero_terms_query": "NONE",
    667. "auto_generate_synonyms_phrase_query": true,
    668. "boost": 2
    669. }
    670. }
    671. },
    672. {
    673. "match": {
    674. "twoName": {
    675. "query": "桶装水",
    676. "operator": "AND",
    677. "prefix_length": 0,
    678. "max_expansions": 50,
    679. "fuzzy_transpositions": true,
    680. "lenient": false,
    681. "zero_terms_query": "NONE",
    682. "auto_generate_synonyms_phrase_query": true,
    683. "boost": 2
    684. }
    685. }
    686. },
    687. {
    688. "match": {
    689. "threeName": {
    690. "query": "桶装水",
    691. "operator": "AND",
    692. "prefix_length": 0,
    693. "max_expansions": 50,
    694. "fuzzy_transpositions": true,
    695. "lenient": false,
    696. "zero_terms_query": "NONE",
    697. "auto_generate_synonyms_phrase_query": true,
    698. "boost": 2
    699. }
    700. }
    701. }
    702. ],
    703. "adjust_pure_negative": true,
    704. "boost": 1
    705. }
    706. },
    707. "_source": {
    708. "includes": [],
    709. "excludes": [
    710. "introduces",
    711. "imagelist",
    712. "tFilteritems",
    713. "creationtime"
    714. ]
    715. },
    716. "sort": [
    717. {
    718. "personSort": {
    719. "order": "asc"
    720. }
    721. }
    722. ],
    723. "track_total_hits": 2147483647,
    724. "highlight": {
    725. "pre_tags": [
    726. "<font color='red'>"
    727. ],
    728. "post_tags": [
    729. "</font>"
    730. ]
    731. }
    732. }
    733. ##获取索引mapping
    734. GET /test20220104/_mapping
    735. DELETE /slorsearch/
    736. #最大细度分词
    737. GET _analyze
    738. {
    739. "analyzer": "ik_max_word",
    740. "text": "[186400,186393,335723]"
    741. }
    742. #最大细度分词
    743. GET _analyze
    744. {
    745. "analyzer": "ik_smart",
    746. "text": "祺宝 QIBAO 优质压花水牛皮安全凉鞋(防砸,防刺穿)-42 78029防砸,防刺穿-42 4F1280"
    747. }
    748. #最小细度分词
    749. GET _analyze
    750. {
    751. "analyzer": "ik_smart",
    752. "text": "惠普(HP)M104w黑白激光打印机 无线 手机打印 家用 小型办公 P11081106升级wifi版"
    753. }
    754. #最小细度分词
    755. GET _analyze
    756. {
    757. "analyzer": "ik_max_word",
    758. "text": "矿泉水都元人合 至尊"
    759. }
    760. GET _analyze
    761. {
    762. "analyzer": "ik_smart",
    763. "text": "huawei华为"
    764. }
    765. DELETE tjecommodity-20220119
    766. #设置索引mapping
    767. PUT /tjecommodity-20220119/?pretty
    768. {
    769. "settings": {
    770. "number_of_shards": 5,
    771. "number_of_replicas": 2
    772. },
    773. "mappings" : {
    774. "properties" : {
    775. "balancetime" : {
    776. "type" : "long"
    777. },
    778. "brandid" : {
    779. "type" : "long"
    780. },
    781. "brandname" : {
    782. "type" : "text",
    783. "fields" : {
    784. "keyword" : {
    785. "type" : "keyword",
    786. "ignore_above" : 256
    787. }
    788. },
    789. "analyzer" : "ik_smart"
    790. },
    791. "commentNum" : {
    792. "type" : "keyword"
    793. },
    794. "companytext" : {
    795. "type" : "text",
    796. "fields" : {
    797. "keyword" : {
    798. "type" : "keyword",
    799. "ignore_above" : 256
    800. }
    801. }
    802. },
    803. "creationtime" : {
    804. "type" : "date",
    805. "format" : "yyyy-MM-dd HH:mm:ss"
    806. },
    807. "deposit" : {
    808. "type" : "long"
    809. },
    810. "discount" : {
    811. "type" : "long"
    812. },
    813. "enterpriseSort" : {
    814. "type" : "long"
    815. },
    816. "extension_field" : {
    817. "type" : "text",
    818. "fields" : {
    819. "keyword" : {
    820. "type" : "keyword",
    821. "ignore_above" : 256
    822. }
    823. }
    824. },
    825. "filteritem" : {
    826. "type" : "text",
    827. "fields" : {
    828. "keyword" : {
    829. "type" : "keyword",
    830. "ignore_above" : 256
    831. }
    832. },
    833. "analyzer" : "ik_max_word"
    834. },
    835. "futuresnum" : {
    836. "type" : "text",
    837. "fields" : {
    838. "keyword" : {
    839. "type" : "keyword",
    840. "ignore_above" : 256
    841. }
    842. }
    843. },
    844. "hot" : {
    845. "type" : "long"
    846. },
    847. "id" : {
    848. "type" : "long"
    849. },
    850. "image" : {
    851. "type" : "text",
    852. "index": false,
    853. "fields" : {
    854. "keyword" : {
    855. "type" : "keyword",
    856. "ignore_above" : 256
    857. }
    858. }
    859. },
    860. "imagelist" : {
    861. "type" : "text",
    862. "index": false,
    863. "fields" : {
    864. "keyword" : {
    865. "type" : "keyword",
    866. "ignore_above" : 256
    867. }
    868. }
    869. },
    870. "introduces" : {
    871. "type" : "text",
    872. "index": false,
    873. "fields" : {
    874. "keyword" : {
    875. "type" : "keyword",
    876. "ignore_above" : 256
    877. }
    878. }
    879. },
    880. "minimum" : {
    881. "type" : "long"
    882. },
    883. "names" : {
    884. "type" : "text",
    885. "fields" : {
    886. "keyword" : {
    887. "type" : "keyword",
    888. "ignore_above" : 256
    889. }
    890. },
    891. "analyzer" : "ik_smart"
    892. },
    893. "num" : {
    894. "type" : "long"
    895. },
    896. "number" : {
    897. "type" : "text",
    898. "fields" : {
    899. "keyword" : {
    900. "type" : "keyword",
    901. "ignore_above" : 256
    902. }
    903. }
    904. },
    905. "nums" : {
    906. "type" : "long"
    907. },
    908. "oneName" : {
    909. "type" : "text",
    910. "analyzer": "ik_max_word",
    911. "fields" : {
    912. "keyword" : {
    913. "type" : "keyword",
    914. "ignore_above" : 256
    915. }
    916. }
    917. },
    918. "oneid" : {
    919. "type" : "long"
    920. },
    921. "personSort" : {
    922. "type" : "long"
    923. },
    924. "prices" : {
    925. "type" : "long"
    926. },
    927. "recommend" : {
    928. "type" : "long"
    929. },
    930. "specifications" : {
    931. "type" : "text",
    932. "fields" : {
    933. "keyword" : {
    934. "type" : "keyword",
    935. "ignore_above" : 256
    936. }
    937. }
    938. },
    939. "status" : {
    940. "type" : "long"
    941. },
    942. "supplierid" : {
    943. "type" : "long"
    944. },
    945. "supplieridname" : {
    946. "type" : "text",
    947. "fields" : {
    948. "keyword" : {
    949. "type" : "keyword",
    950. "ignore_above" : 256
    951. }
    952. },
    953. "analyzer" : "ik_smart"
    954. },
    955. "tFilteritems" : {
    956. "properties" : {
    957. "id" : {
    958. "type" : "long"
    959. },
    960. "names" : {
    961. "type" : "text",
    962. "fields" : {
    963. "keyword" : {
    964. "type" : "keyword",
    965. "ignore_above" : 256
    966. }
    967. },
    968. "analyzer" : "ik_smart"
    969. },
    970. "nums" : {
    971. "type" : "long"
    972. },
    973. "params" : {
    974. "type" : "object"
    975. },
    976. "pid" : {
    977. "type" : "long"
    978. },
    979. "status" : {
    980. "type" : "integer"
    981. },
    982. "tKeywordList" : {
    983. "properties" : {
    984. "id" : {
    985. "type" : "long"
    986. },
    987. "names" : {
    988. "type" : "text",
    989. "fields" : {
    990. "keyword" : {
    991. "type" : "keyword",
    992. "ignore_above" : 256
    993. }
    994. },
    995. "analyzer" : "ik_smart"
    996. },
    997. "number" : {
    998. "type" : "long"
    999. },
    1000. "params" : {
    1001. "type" : "object"
    1002. },
    1003. "pid" : {
    1004. "type" : "long"
    1005. }
    1006. }
    1007. }
    1008. }
    1009. },
    1010. "tSpecifications" : {
    1011. "properties" : {
    1012. "creationtime" : {
    1013. "type" : "date",
    1014. "format" : "yyyy-MM-dd HH:mm:ss"
    1015. },
    1016. "discount" : {
    1017. "type" : "float"
    1018. },
    1019. "id" : {
    1020. "type" : "long"
    1021. },
    1022. "names" : {
    1023. "type" : "text",
    1024. "fields" : {
    1025. "keyword" : {
    1026. "type" : "keyword",
    1027. "ignore_above" : 256
    1028. }
    1029. },
    1030. "analyzer" : "ik_smart"
    1031. },
    1032. "number" : {
    1033. "type" : "long"
    1034. },
    1035. "prices" : {
    1036. "type" : "double"
    1037. },
    1038. "scribingprice" : {
    1039. "type" : "double"
    1040. },
    1041. "stocknum" : {
    1042. "type" : "long"
    1043. },
    1044. "tCommodityPriceSets" : {
    1045. "properties" : {
    1046. "commodityId" : {
    1047. "type" : "long"
    1048. },
    1049. "id" : {
    1050. "type" : "long"
    1051. },
    1052. "salePrice" : {
    1053. "type" : "float"
    1054. },
    1055. "scribePrice" : {
    1056. "type" : "float"
    1057. },
    1058. "sourceId" : {
    1059. "type" : "long"
    1060. },
    1061. "spec" : {
    1062. "type" : "long"
    1063. },
    1064. "type" : {
    1065. "type" : "long"
    1066. }
    1067. }
    1068. }
    1069. }
    1070. },
    1071. "threeName" : {
    1072. "type" : "text",
    1073. "analyzer": "ik_max_word",
    1074. "fields" : {
    1075. "keyword" : {
    1076. "type" : "keyword",
    1077. "ignore_above" : 256
    1078. }
    1079. }
    1080. },
    1081. "threeid" : {
    1082. "type" : "long"
    1083. },
    1084. "top" : {
    1085. "type" : "long"
    1086. },
    1087. "transactionnum" : {
    1088. "type" : "long"
    1089. },
    1090. "twoName" : {
    1091. "type" : "text",
    1092. "analyzer": "ik_max_word",
    1093. "fields" : {
    1094. "keyword" : {
    1095. "type" : "keyword",
    1096. "ignore_above" : 256
    1097. }
    1098. }
    1099. },
    1100. "twoid" : {
    1101. "type" : "long"
    1102. },
    1103. "types" : {
    1104. "type" : "integer"
    1105. }
    1106. }
    1107. }
    1108. }
    1109. GET tjecommodity-20220118/_search
    1110. {
    1111. "from": 0,
    1112. "size": 16,
    1113. "query": {
    1114. "bool": {
    1115. "should": [
    1116. {
    1117. "match": {
    1118. "extension_field": {
    1119. "query": "水",
    1120. "operator": "AND",
    1121. "prefix_length": 0,
    1122. "max_expansions": 50,
    1123. "fuzzy_transpositions": true,
    1124. "lenient": false,
    1125. "zero_terms_query": "NONE",
    1126. "auto_generate_synonyms_phrase_query": true,
    1127. "boost": 20
    1128. }
    1129. }
    1130. },
    1131. {
    1132. "match": {
    1133. "names": {
    1134. "query": "水",
    1135. "operator": "AND",
    1136. "prefix_length": 0,
    1137. "max_expansions": 50,
    1138. "fuzzy_transpositions": true,
    1139. "lenient": false,
    1140. "zero_terms_query": "NONE",
    1141. "auto_generate_synonyms_phrase_query": true,
    1142. "boost": 15
    1143. }
    1144. }
    1145. },
    1146. {
    1147. "match": {
    1148. "brandname": {
    1149. "query": "水",
    1150. "operator": "AND",
    1151. "prefix_length": 0,
    1152. "max_expansions": 50,
    1153. "fuzzy_transpositions": true,
    1154. "lenient": false,
    1155. "zero_terms_query": "NONE",
    1156. "auto_generate_synonyms_phrase_query": true,
    1157. "boost": 8
    1158. }
    1159. }
    1160. },
    1161. {
    1162. "match": {
    1163. "oneName": {
    1164. "query": "水",
    1165. "operator": "AND",
    1166. "prefix_length": 0,
    1167. "max_expansions": 50,
    1168. "fuzzy_transpositions": true,
    1169. "lenient": false,
    1170. "zero_terms_query": "NONE",
    1171. "auto_generate_synonyms_phrase_query": true,
    1172. "boost": 2
    1173. }
    1174. }
    1175. },
    1176. {
    1177. "match": {
    1178. "twoName": {
    1179. "query": "水",
    1180. "operator": "AND",
    1181. "prefix_length": 0,
    1182. "max_expansions": 50,
    1183. "fuzzy_transpositions": true,
    1184. "lenient": false,
    1185. "zero_terms_query": "NONE",
    1186. "auto_generate_synonyms_phrase_query": true,
    1187. "boost": 2
    1188. }
    1189. }
    1190. },
    1191. {
    1192. "match": {
    1193. "threeName": {
    1194. "query": "水",
    1195. "operator": "AND",
    1196. "prefix_length": 0,
    1197. "max_expansions": 50,
    1198. "fuzzy_transpositions": true,
    1199. "lenient": false,
    1200. "zero_terms_query": "NONE",
    1201. "auto_generate_synonyms_phrase_query": true,
    1202. "boost": 2
    1203. }
    1204. }
    1205. }
    1206. ],
    1207. "adjust_pure_negative": true,
    1208. "boost": 1
    1209. }
    1210. },
    1211. "_source": {
    1212. "includes": [],
    1213. "excludes": [
    1214. "introduces",
    1215. "imagelist",
    1216. "tFilteritems",
    1217. "creationtime"
    1218. ]
    1219. },
    1220. "sort": [
    1221. {
    1222. "personSort": {
    1223. "order": "asc"
    1224. }
    1225. },
    1226. {
    1227. "_score": {
    1228. "order": "desc"
    1229. }
    1230. }
    1231. ],
    1232. "track_total_hits": 2147483647,
    1233. "highlight": {
    1234. "pre_tags": [
    1235. "<font color='red'>"
    1236. ],
    1237. "post_tags": [
    1238. "</font>"
    1239. ]
    1240. }
    1241. }
    1242. #es 数据索引对拷
    1243. POST _reindex
    1244. {
    1245. "source": {
    1246. "index": "tjecommodity20220117"
    1247. },
    1248. "dest": {
    1249. "index":"tjecommodity-20220118",
    1250. "version_type": "internal"
    1251. }
    1252. }
    1253. #设置索引mapping 旧
    1254. PUT /tjecommodity20220118/?pretty
    1255. {
    1256. "settings": {
    1257. "number_of_shards": 5,
    1258. "number_of_replicas": 2
    1259. },
    1260. "mappings": {
    1261. "properties": {
    1262. "brandName" : {
    1263. "type" : "text",
    1264. "analyzer": "ik_smart",
    1265. "fields" : {
    1266. "keyword" : {
    1267. "type" : "keyword",
    1268. "ignore_above" : 256
    1269. }
    1270. }
    1271. },
    1272. "brandid" : {
    1273. "type" : "long"
    1274. },
    1275. "commentNum" : {
    1276. "type" : "long"
    1277. },
    1278. "companytext" : {
    1279. "type" : "text",
    1280. "index": false,
    1281. "fields" : {
    1282. "keyword" : {
    1283. "type" : "keyword",
    1284. "ignore_above" : 256
    1285. }
    1286. }
    1287. },
    1288. "creationtime" : {
    1289. "type" : "date"
    1290. , "format": "YYYY-MM-dd HH:mm:ss"
    1291. },
    1292. "discount" : {
    1293. "type" : "long"
    1294. },
    1295. "filteritem" : {
    1296. "type" : "text",
    1297. "fields" : {
    1298. "keyword" : {
    1299. "type" : "keyword",
    1300. "ignore_above" : 256
    1301. }
    1302. }
    1303. },
    1304. "futuresnum" : {
    1305. "type" : "text",
    1306. "fields" : {
    1307. "keyword" : {
    1308. "type" : "keyword",
    1309. "ignore_above" : 256
    1310. }
    1311. }
    1312. },
    1313. "id" : {
    1314. "type" : "long"
    1315. },
    1316. "image" : {
    1317. "type" : "keyword"
    1318. },
    1319. "imagelist" : {
    1320. "type" : "keyword"
    1321. },
    1322. "introduces" : {
    1323. "type" : "text",
    1324. "index": false
    1325. },
    1326. "isSelf" : {
    1327. "type" : "integer"
    1328. },
    1329. "minimum" : {
    1330. "type" : "long"
    1331. },
    1332. "names" : {
    1333. "type" : "text",
    1334. "analyzer": "ik_smart",
    1335. "fields" : {
    1336. "keyword" : {
    1337. "type" : "keyword",
    1338. "ignore_above" : 256
    1339. }
    1340. }
    1341. },
    1342. "number" : {
    1343. "type" : "keyword",
    1344. "fields" : {
    1345. "keyword" : {
    1346. "type" : "keyword",
    1347. "ignore_above" : 256
    1348. }
    1349. }
    1350. },
    1351. "nums" : {
    1352. "type" : "long"
    1353. },
    1354. "oneid" : {
    1355. "type" : "long"
    1356. },
    1357. "prices" : {
    1358. "type" : "double"
    1359. },
    1360. "recommend" : {
    1361. "type" : "long"
    1362. },
    1363. "shopName" : {
    1364. "type" : "text",
    1365. "analyzer": "ik_max_word",
    1366. "fields" : {
    1367. "keyword" : {
    1368. "type" : "keyword",
    1369. "ignore_above" : 256
    1370. }
    1371. }
    1372. },
    1373. "showPrice" : {
    1374. "type" : "float"
    1375. },
    1376. "showScribingPrice" : {
    1377. "type" : "float"
    1378. },
    1379. "specifications" : {
    1380. "type" : "text",
    1381. "fields" : {
    1382. "keyword" : {
    1383. "type" : "keyword",
    1384. "ignore_above" : 256
    1385. }
    1386. }
    1387. },
    1388. "status" : {
    1389. "type" : "integer"
    1390. },
    1391. "supplierid" : {
    1392. "type" : "long"
    1393. },
    1394. "threeid" : {
    1395. "type" : "long"
    1396. },
    1397. "transactionnum" : {
    1398. "type" : "long"
    1399. },
    1400. "twoid" : {
    1401. "type" : "long"
    1402. },
    1403. "types" : {
    1404. "type" : "long"
    1405. },
    1406. "yesCollection" : {
    1407. "type" : "boolean"
    1408. }
    1409. }
    1410. }
    1411. }
    1412. GET /commodity/_search/
    1413. POST /commodity/_doc
    1414. {
    1415. "brandid": 12596,
    1416. "brandname": "COMIX/齐心",
    1417. "commentNum": 0,
    1418. "deposit": 0,
    1419. "discount": 1,
    1420. "enterpriseSort": 3,
    1421. "hot": 0,
    1422. "id": 187,
    1423. "image": "http://res.officebox.cn/Content/Upload/Image/Product_Cover/55224cea58834a6a87c931e32250720a/42dcf49fe6d45a66.jpg",
    1424. "minimum": 0,
    1425. "names": "齐心(Comix)小美工刀片(B2851) ",
    1426. "num": 0,
    1427. "number": "2038363",
    1428. "nums": 100,
    1429. "oneid": 14533,
    1430. "personSort": 6,
    1431. "prices": 2.42,
    1432. "recommend": 1,
    1433. "specifications": "218",
    1434. "status": 1,
    1435. "supplierid": 26,
    1436. "supplieridname": "广东今日合作办公用品有限公司",
    1437. "tFilteritems": [
    1438. {
    1439. "id": 36973,
    1440. "names": "分类:",
    1441. "nums": 0,
    1442. "params": { },
    1443. "pid": 14845,
    1444. "status": 1,
    1445. "tKeywordList": [
    1446. {
    1447. "id": 273370,
    1448. "names": "手动工具",
    1449. "number": 0,
    1450. "params": { },
    1451. "pid": 36973
    1452. }
    1453. ,
    1454. {
    1455. "id": 273371,
    1456. "names": "办公文具",
    1457. "number": 0,
    1458. "params": { },
    1459. "pid": 36973
    1460. }
    1461. ,
    1462. {
    1463. "id": 273396,
    1464. "names": "园艺工具",
    1465. "number": 0,
    1466. "params": { },
    1467. "pid": 36973
    1468. }
    1469. ]
    1470. }
    1471. ,
    1472. {
    1473. "id": 36974,
    1474. "names": "材质:",
    1475. "nums": 0,
    1476. "params": { },
    1477. "pid": 14845,
    1478. "status": 1,
    1479. "tKeywordList": [
    1480. {
    1481. "id": 273374,
    1482. "names": "钛钢",
    1483. "number": 0,
    1484. "params": { },
    1485. "pid": 36974
    1486. }
    1487. ,
    1488. {
    1489. "id": 273375,
    1490. "names": "铬钒合金钢",
    1491. "number": 0,
    1492. "params": { },
    1493. "pid": 36974
    1494. }
    1495. ,
    1496. {
    1497. "id": 273376,
    1498. "names": "合金",
    1499. "number": 0,
    1500. "params": { },
    1501. "pid": 36974
    1502. }
    1503. ,
    1504. {
    1505. "id": 273379,
    1506. "names": "铸钢",
    1507. "number": 0,
    1508. "params": { },
    1509. "pid": 36974
    1510. }
    1511. ,
    1512. {
    1513. "id": 273380,
    1514. "names": "其他",
    1515. "number": 0,
    1516. "params": { },
    1517. "pid": 36974
    1518. }
    1519. ,
    1520. {
    1521. "id": 273381,
    1522. "names": "高碳钢",
    1523. "number": 0,
    1524. "params": { },
    1525. "pid": 36974
    1526. }
    1527. ,
    1528. {
    1529. "id": 273382,
    1530. "names": "陶瓷",
    1531. "number": 0,
    1532. "params": { },
    1533. "pid": 36974
    1534. }
    1535. ,
    1536. {
    1537. "id": 273384,
    1538. "names": "玻璃",
    1539. "number": 0,
    1540. "params": { },
    1541. "pid": 36974
    1542. }
    1543. ,
    1544. {
    1545. "id": 273385,
    1546. "names": "镍铬合金钢",
    1547. "number": 0,
    1548. "params": { },
    1549. "pid": 36974
    1550. }
    1551. ,
    1552. {
    1553. "id": 273387,
    1554. "names": "铝合金",
    1555. "number": 0,
    1556. "params": { },
    1557. "pid": 36974
    1558. }
    1559. ,
    1560. {
    1561. "id": 273388,
    1562. "names": "碳钢",
    1563. "number": 0,
    1564. "params": { },
    1565. "pid": 36974
    1566. }
    1567. ,
    1568. {
    1569. "id": 273391,
    1570. "names": "铬钼合金钢",
    1571. "number": 0,
    1572. "params": { },
    1573. "pid": 36974
    1574. }
    1575. ,
    1576. {
    1577. "id": 273392,
    1578. "names": "不锈钢",
    1579. "number": 0,
    1580. "params": { },
    1581. "pid": 36974
    1582. }
    1583. ,
    1584. {
    1585. "id": 273397,
    1586. "names": "塑料",
    1587. "number": 0,
    1588. "params": { },
    1589. "pid": 36974
    1590. }
    1591. ,
    1592. {
    1593. "id": 273400,
    1594. "names": "铁镍合金钢",
    1595. "number": 0,
    1596. "params": { },
    1597. "pid": 36974
    1598. }
    1599. ,
    1600. {
    1601. "id": 273401,
    1602. "names": "棉",
    1603. "number": 0,
    1604. "params": { },
    1605. "pid": 36974
    1606. }
    1607. ,
    1608. {
    1609. "id": 273407,
    1610. "names": "铜合金",
    1611. "number": 0,
    1612. "params": { },
    1613. "pid": 36974
    1614. }
    1615. ,
    1616. {
    1617. "id": 273409,
    1618. "names": "木",
    1619. "number": 0,
    1620. "params": { },
    1621. "pid": 36974
    1622. }
    1623. ]
    1624. }
    1625. ,
    1626. {
    1627. "id": 36975,
    1628. "names": "类型:",
    1629. "nums": 0,
    1630. "params": { },
    1631. "pid": 14845,
    1632. "status": 1,
    1633. "tKeywordList": [
    1634. {
    1635. "id": 273377,
    1636. "names": "办公摆件",
    1637. "number": 0,
    1638. "params": { },
    1639. "pid": 36975
    1640. }
    1641. ,
    1642. {
    1643. "id": 273378,
    1644. "names": "切纸刀",
    1645. "number": 0,
    1646. "params": { },
    1647. "pid": 36975
    1648. }
    1649. ,
    1650. {
    1651. "id": 273383,
    1652. "names": "绘图测量",
    1653. "number": 0,
    1654. "params": { },
    1655. "pid": 36975
    1656. }
    1657. ,
    1658. {
    1659. "id": 273386,
    1660. "names": "剪刀/美工刀",
    1661. "number": 0,
    1662. "params": { },
    1663. "pid": 36975
    1664. }
    1665. ,
    1666. {
    1667. "id": 273389,
    1668. "names": "其他",
    1669. "number": 0,
    1670. "params": { },
    1671. "pid": 36975
    1672. }
    1673. ,
    1674. {
    1675. "id": 273390,
    1676. "names": "笔筒/收纳",
    1677. "number": 0,
    1678. "params": { },
    1679. "pid": 36975
    1680. }
    1681. ,
    1682. {
    1683. "id": 273393,
    1684. "names": "胶带/封装器",
    1685. "number": 0,
    1686. "params": { },
    1687. "pid": 36975
    1688. }
    1689. ,
    1690. {
    1691. "id": 273395,
    1692. "names": "办公套装",
    1693. "number": 0,
    1694. "params": { },
    1695. "pid": 36975
    1696. }
    1697. ,
    1698. {
    1699. "id": 273398,
    1700. "names": "切割雕刻垫板",
    1701. "number": 0,
    1702. "params": { },
    1703. "pid": 36975
    1704. }
    1705. ,
    1706. {
    1707. "id": 273402,
    1708. "names": "办公生活",
    1709. "number": 0,
    1710. "params": { },
    1711. "pid": 36975
    1712. }
    1713. ,
    1714. {
    1715. "id": 273404,
    1716. "names": "雕刻刀",
    1717. "number": 0,
    1718. "params": { },
    1719. "pid": 36975
    1720. }
    1721. ,
    1722. {
    1723. "id": 273405,
    1724. "names": "刀片",
    1725. "number": 0,
    1726. "params": { },
    1727. "pid": 36975
    1728. }
    1729. ,
    1730. {
    1731. "id": 273408,
    1732. "names": "胶棒/胶水",
    1733. "number": 0,
    1734. "params": { },
    1735. "pid": 36975
    1736. }
    1737. ]
    1738. }
    1739. ,
    1740. {
    1741. "id": 36976,
    1742. "names": "剪切类:",
    1743. "nums": 0,
    1744. "params": { },
    1745. "pid": 14845,
    1746. "status": 1,
    1747. "tKeywordList": [
    1748. {
    1749. "id": 273372,
    1750. "names": "锉刀",
    1751. "number": 0,
    1752. "params": { },
    1753. "pid": 36976
    1754. }
    1755. ,
    1756. {
    1757. "id": 273373,
    1758. "names": "美工刀",
    1759. "number": 0,
    1760. "params": { },
    1761. "pid": 36976
    1762. }
    1763. ,
    1764. {
    1765. "id": 273394,
    1766. "names": "割刀",
    1767. "number": 0,
    1768. "params": { },
    1769. "pid": 36976
    1770. }
    1771. ,
    1772. {
    1773. "id": 273399,
    1774. "names": "雕刻刀",
    1775. "number": 0,
    1776. "params": { },
    1777. "pid": 36976
    1778. }
    1779. ,
    1780. {
    1781. "id": 273403,
    1782. "names": "壁纸刀",
    1783. "number": 0,
    1784. "params": { },
    1785. "pid": 36976
    1786. }
    1787. ,
    1788. {
    1789. "id": 273406,
    1790. "names": "园林剪",
    1791. "number": 0,
    1792. "params": { },
    1793. "pid": 36976
    1794. }
    1795. ]
    1796. }
    1797. ],
    1798. "tSpecifications": [
    1799. {
    1800. "discount": 0.6,
    1801. "id": 218,
    1802. "names": "2038363",
    1803. "number": 187,
    1804. "prices": 2.42,
    1805. "scribingprice": 4,
    1806. "stocknum": 100,
    1807. "tCommodityPriceSets": [ ]
    1808. }
    1809. ],
    1810. "threeid": 14845,
    1811. "top": 0,
    1812. "transactionnum": 0,
    1813. "twoid": 14822,
    1814. "types": 1
    1815. }