아빠는 개발자

[Aqqle] API - 상품 본문

Aqqle

[Aqqle] API - 상품

father6019 2023. 10. 7. 01:56
728x90
반응형

검색대상

products index (alias : shop)

 

index in eshead

index 의 prefix 랑 alias 를 맞춰야 겠다. 

 

index 수정

 

쿼리의 구조는 아래와 같은데.. 뭔가 복잡하네 

query > function_score > query > bool > must , should 

query > function_score > functions > filter > match_all 

query > function_score > functions > script_score > script

 

위의 구조에서 script 의 유사도 비교는 cosineSimilarity 로 별다른 계산로직을 태우지 않고 일단 실행

결과값에 vector  제외 (excludes)

API swagger 가 설치되어 있으니 검색 테스트

response

 

전체 검색 쿼리 

더보기

{
  "size": 8,
  "query": {
    "function_score": {
      "query": {
        "bool": {
          "must": [
            {
              "multi_match": {
                "query": "몽클레어",
                "fields": [
                  "category^1.0",
                  "name^1.0"
                ],
                "type": "best_fields",
                "operator": "OR",
                "slop": 0,
                "prefix_length": 0,
                "max_expansions": 50,
                "zero_terms_query": "NONE",
                "auto_generate_synonyms_phrase_query": true,
                "fuzzy_transpositions": true,
                "boost": 1
              }
            }
          ],
          "should": [
            {
              "multi_match": {
                "query": "몽클레어",
                "fields": [
                  "category1^1.0",
                  "category2^1.0",
                  "category3^1.0",
                  "category4^1.0",
                  "category5^1.0"
                ],
                "type": "best_fields",
                "operator": "OR",
                "slop": 0,
                "prefix_length": 0,
                "max_expansions": 50,
                "zero_terms_query": "NONE",
                "auto_generate_synonyms_phrase_query": true,
                "fuzzy_transpositions": true,
                "boost": 1
              }
            }
          ],
          "adjust_pure_negative": true,
          "boost": 1
        }
      },
      "functions": [
        {
          "filter": {
            "match_all": {
              "boost": 1
            }
          },
          "weight": 0.1,
          "script_score": {
            "script": {
              "source": "cosineSimilarity(params.query_vector, 'feature_vector') + 1.0",
              "lang": "painless",
              "params": {
                "query_vector": [
                  0.06818445026874542,
                  -0.06987819075584412,
                  -0.05107991769909859,
                  -0.019045716151595116,
                  -0.07658229768276215,
                  0.00346165569499135,
                  0.00027048029005527496,
                  0.01276461873203516,
                  0.002449141815304756,
                  -0.016933543607592583,
                  -0.08012636750936508,
                  -0.06629989296197891,
                  -0.023868875578045845,
                  0.010816497728228569,
                  0.01616874895989895,
                  0.004476294387131929,
                  -0.05286776274442673,
                  -0.04757852107286453,
                  -0.049932222813367844,
                  0.007322469726204872,
                  0.054515041410923004,
                  0.012682243250310421,
                  0.023228123784065247,
                  -0.008232085965573788,
                  0.08248063921928406,
                  -0.026477936655282974,
                  0.03134554624557495,
                  -0.017249666154384613,
                  -0.10199302434921265,
                  -0.007567521650344133,
                  0.030317101627588272,
                  0.0027051735669374466,
                  0.005342681892216206,
                  -0.021914193406701088,
                  0.048232220113277435,
                  -0.02336234226822853,
                  -0.06767726689577103,
                  -0.040480151772499084,
                  -0.013797488994896412,
                  -0.058826617896556854,
                  0.05930052325129509,
                  -0.02477271854877472,
                  -0.04433811083436012,
                  -0.014382167719304562,
                  0.033414505422115326,
                  0.005705543793737888,
                  -0.01434264425188303,
                  0.005857172422111034,
                  -0.008658657781779766,
                  -0.024869585409760475,
                  -0.062157582491636276,
                  -0.021429412066936493,
                  -0.028858553618192673,
                  -0.058308739215135574,
                  -0.013925359584391117,
                  -0.002628082875162363,
                  -0.05877390131354332,
                  -0.05885634571313858,
                  -0.06829680502414703,
                  -0.021407341584563255,
                  0.05075149983167648,
                  -0.014574302360415459,
                  -0.043324071913957596,
                  0.006232087966054678,
                  -0.04336431622505188,
                  0.02765982411801815,
                  -0.09362604469060898,
                  0.09402148425579071,
                  -0.053629226982593536,
                  -0.05349602922797203,
                  -0.009643996134400368,
                  -0.006013847421854734,
                  -0.05378904193639755,
                  0.014890535734593868,
                  0.03555208444595337,
                  0.038243409246206284,
                  0.016802266240119934,
                  0.02238272689282894,
                  0.018847370520234108,
                  0.002105634193867445,
                  0.0020308271050453186,
                  -0.016440164297819138,
                  -0.13917718827724457,
                  0.01087966002523899,
                  0.01181822456419468,
                  0.020594097673892975,
                  0.03210241347551346,
                  0.00660413084551692,
                  -0.009986087679862976,
                  0.09838484227657318,
                  -0.046800389885902405,
                  0.05276455730199814,
                  -0.11980051547288895,
                  0.056005869060754776,
                  -0.022932300344109535,
                  0.14477843046188354,
                  0.008759994991123676,
                  0.008469190448522568,
                  -0.027020148932933807,
                  0.04580157622694969,
                  -0.022587774321436882,
                  -0.012928863987326622,
                  0.02803194709122181,
                  -0.04877905547618866,
                  -0.06648500263690948,
                  0.06096429377794266,
                  -0.013575597666203976,
                  0.020335780456662178,
                  -0.05430364981293678,
                  -0.027442848309874535,
                  0.0720476508140564,
                  0.08253075927495956,
                  -0.03515633940696716,
                  0.02133636549115181,
                  0.02827838622033596,
                  0.10414920002222061,
                  0.019291352480649948,
                  0.01562611386179924,
                  0.0022433456033468246,
                  -0.0068700662814080715,
                  -0.06594023108482361,
                  -0.05940721184015274,
                  0.0394403450191021,
                  -0.0041070785373449326,
                  0.021426694467663765,
                  -0.029988838359713554,
                  0.09190281480550766,
                  0.03516887500882149,
                  0.03472285717725754,
                  -0.0047971829771995544,
                  -0.03426198288798332,
                  0.04177616536617279,
                  0.015155713073909283,
                  -0.04837016761302948,
                  -0.018877239897847176,
                  -0.04088686406612396,
                  -0.030311813578009605,
                  0.07459447532892227,
                  -0.034808773547410965,
                  0.018603244796395302,
                  0.030506843701004982,
                  0.017168065533041954,
                  -0.04780992493033409,
                  -0.010424918495118618,
                  0.046733222901821136,
                  -0.011801784858107567,
                  -0.024934886023402214,
                  -0.05495421588420868,
                  -0.005834547802805901,
                  0.03019537962973118,
                  -0.005479035899043083,
                  0.05667755380272865,
                  0.007952680811285973,
                  -0.09004498273134232,
                  0.012622958980500698,
                  0.03549448400735855,
                  0.007898631505668163,
                  0.035347700119018555,
                  -0.021078849211335182,
                  -0.03550826385617256,
                  0.041530296206474304,
                  0.008320179767906666,
                  -0.0019791547674685717,
                  0.04745400324463844,
                  -0.006401346065104008,
                  -0.012786241248250008,
                  0.0020653733517974615,
                  -0.04723713546991348,
                  0.02240094728767872,
                  -0.00007257438846863806,
                  -0.06591122597455978,
                  0.05696605518460274,
                  -0.012127857655286789,
                  0.04030058905482292,
                  0.03766883164644241,
                  0.012985698878765106,
                  -0.03776470571756363,
                  0.011371239088475704,
                  -0.08211350440979004,
                  -0.09715288877487183,
                  -0.01785210706293583,
                  -0.0027308145072311163,
                  -0.009738984517753124,
                  0.011086353100836277,
                  -0.11688284575939178,
                  -0.02773197926580906,
                  0.025256911292672157,
                  -0.009165034629404545,
                  0.05290035530924797,
                  -0.03001435101032257,
                  0.05255511775612831,
                  -0.017276382073760033,
                  0.03595928102731705,
                  -0.07131555676460266,
                  -0.04340377077460289,
                  0.07725530862808228,
                  -0.046596527099609375,
                  -0.05104717239737511,
                  -0.06778284907341003,
                  0.04254366457462311,
                  0.03872235491871834,
                  -0.07209054380655289,
                  -0.012415129691362381,
                  -0.03546597436070442,
                  -0.023349642753601074,
                  -0.05032148212194443,
                  -0.07361748814582825,
                  0.08405778557062149,
                  0.03040654957294464,
                  -0.020432794466614723,
                  0.06266467273235321,
                  -0.06821777671575546,
                  -0.026785533875226974,
                  0.046821605414152145,
                  -0.030829718336462975,
                  -0.017218731343746185,
                  -0.006678517442196608,
                  0.0008689907845109701,
                  0.07503417134284973,
                  -0.03678382188081741,
                  -0.040145035833120346,
                  0.019301660358905792,
                  0.08869113773107529,
                  -0.007342831697314978,
                  0.050910402089357376,
                  0.035503972321748734,
                  -0.07648616284132004,
                  0.0335206501185894,
                  0.06279540807008743,
                  -0.0005297699826769531,
                  -0.06294862926006317,
                  0.036709826439619064,
                  0.033981990069150925,
                  -0.04488159343600273,
                  0.014367416501045227,
                  0.01576768234372139,
                  0.02128514274954796,
                  -0.03923329338431358,
                  0.020603075623512268,
                  0.03391184285283089,
                  -0.01314940769225359,
                  -0.006255375221371651,
                  0.03239823132753372,
                  0.04713514819741249,
                  -0.05893213674426079,
                  0.01873094215989113,
                  0.008861404843628407,
                  -0.029215244576334953,
                  -0.004603478591889143,
                  0.0026444951072335243,
                  0.045741450041532516,
                  0.004422516096383333,
                  -0.011853701435029507,
                  0.08552154898643494,
                  -0.05301705002784729,
                  0.04063020646572113,
                  -0.03199004754424095,
                  0.05721255764365196,
                  0.031045259907841682,
                  0.02150176838040352,
                  -0.011975890025496483,
                  0.06500732898712158,
                  -0.04799933359026909,
                  -0.062483977526426315,
                  -0.035818763077259064,
                  0.021108053624629974,
                  -0.03523487225174904,
                  -0.03956562653183937,
                  0.0009953744010999799,
                  -0.026655739173293114,
                  0.058305058628320694,
                  0.07153970003128052,
                  0.0866236612200737,
                  -0.006736734416335821,
                  -0.03888886049389839,
                  -0.02685082145035267,
                  -0.07759931683540344,
                  0.06172259524464607,
                  -0.009012364782392979,
                  0.046995483338832855,
                  -0.07266803830862045,
                  -0.008708017878234386,
                  0.01446793507784605,
                  0.03615787252783775,
                  0.019206078723073006,
                  -0.010200714692473412,
                  0.007408101577311754,
                  0.017302189022302628,
                  0.05496318265795708,
                  -0.02362629771232605,
                  -0.031915634870529175,
                  -0.011915444396436214,
                  -0.009456591680645943,
                  -0.02197779342532158,
                  0.003938326612114906,
                  -0.01943233795464039,
                  -0.01203256007283926,
                  0.031691718846559525,
                  -0.006227221339941025,
                  -0.008875440806150436,
                  0.006190176587551832,
                  0.019380098208785057,
                  -0.023511670529842377,
                  0.07896479219198227,
                  -0.04101771116256714,
                  -0.005707877688109875,
                  0.020053347572684288,
                  0.010805091820657253,
                  -0.07375366240739822,
                  0.018470648676156998,
                  0.024349432438611984,
                  0.02454703487455845,
                  0.049557991325855255,
                  -0.04653552547097206,
                  0.05306380242109299,
                  -0.038307491689920425,
                  0.017634164541959763,
                  0.11601392179727554,
                  0.06817246228456497,
                  0.06452254205942154,
                  -0.005319282412528992,
                  -0.0036396856885403395,
                  0.04875259846448898,
                  0.006182425189763308,
                  -0.043177589774131775,
                  0.047768913209438324,
                  0.006257671397179365,
                  -0.10201843827962875,
                  -0.027169501408934593,
                  -0.008579408749938011,
                  0.03273606300354004,
                  0.05144510790705681,
                  0.042445480823516846,
                  -0.020466335117816925,
                  -0.052633196115493774,
                  0.06621091067790985,
                  0.010650420561432838,
                  0.03540144860744476,
                  -0.0039592888206243515,
                  -0.023950129747390747,
                  -0.00843022856861353,
                  0.00371858524158597,
                  -0.038200315088033676,
                  -0.003342938609421253,
                  0.05762125179171562,
                  -0.01603013649582863,
                  -0.020121976733207703,
                  -0.003158553736284375,
                  0.003338099690154195,
                  0.08520679920911789,
                  0.052791595458984375,
                  0.04085021838545799,
                  -0.030541786924004555,
                  0.07680129259824753,
                  -0.006085376255214214,
                  -0.035871025174856186,
                  0.009375697001814842,
                  -0.05716954171657562,
                  -0.0157551858574152,
                  0.07583090662956238,
                  -0.07105255872011185,
                  0.06716839224100113,
                  -0.05381438508629799,
                  0.08359788358211517,
                  -0.05408747121691704,
                  -0.003937493544071913,
                  -0.006752563174813986,
                  -0.017271311953663826,
                  0.01185720507055521,
                  -0.024362655356526375,
                  -0.0025210261810570955,
                  -0.020162221044301987,
                  -0.026778118684887886,
                  0.018869968131184578,
                  0.012674727477133274,
                  -0.07455070316791534,
                  -0.03991280496120453,
                  0.017103975638747215,
                  -0.07241666316986084,
                  -0.039284683763980865,
                  0.02432325668632984,
                  -0.1134401187300682,
                  -0.06582477688789368,
                  0.061528805643320084,
                  0.004733161069452763,
                  0.0204111747443676,
                  -0.03349325433373451,
                  -0.007075736299157143,
                  0.08288145065307617,
                  -0.03277052938938141,
                  0.046539306640625,
                  0.03593748062849045,
                  -0.03313884511590004,
                  0.02679230272769928,
                  -0.043020039796829224,
                  -0.040794581174850464,
                  0.067038893699646,
                  -0.0807940661907196,
                  0.05821814388036728,
                  0.043350763618946075,
                  0.06300721317529678,
                  -0.03159375488758087,
                  0.0138222211971879,
                  0.0025820541195571423,
                  0.027085397392511368,
                  -0.05099573731422424,
                  -0.00021915473917033523,
                  0.034345872700214386,
                  0.00044809069368056953,
                  0.0045360177755355835,
                  0.1056729182600975,
                  -0.026474010199308395,
                  -0.07181766629219055,
                  -0.056814394891262054,
                  0.01004770863801241,
                  0.01574908196926117,
                  0.04042709618806839,
                  -0.03330499306321144,
                  -0.04042476788163185,
                  -0.034623920917510986,
                  -0.009944071993231773,
                  -0.05903885141015053,
                  -0.06497649848461151,
                  0.038724135607481,
                  0.02360781654715538,
                  0.05051984637975693,
                  -0.08708610385656357,
                  -0.009952611289918423,
                  0.008715897798538208,
                  -0.010584426112473011,
                  -0.0506720244884491,
                  0.003468581009656191,
                  0.004935317672789097,
                  0.07427345216274261,
                  -0.0015486999182030559,
                  -0.05249927192926407,
                  -0.029015228152275085,
                  0.04149140045046806,
                  -0.044265735894441605,
                  -0.08874988555908203,
                  0.0071499524638056755,
                  -0.1410912573337555,
                  0.03188960254192352,
                  -0.025188101455569267,
                  -0.045090168714523315,
                  -0.0008771939901635051,
                  -0.0017182565061375499,
                  -0.0636722519993782,
                  -0.004428488202393055,
                  -0.05742990970611572,
                  0.042135898023843765,
                  -0.051866162568330765,
                  0.0020968145690858364,
                  0.005153826903551817,
                  0.00780875189229846,
                  0.08587555587291718,
                  0.028993381187319756,
                  -0.07157769799232483,
                  0.024083560332655907,
                  -0.005290448199957609,
                  0.010726832784712315,
                  -0.016298269852995872,
                  -0.026299098506569862,
                  0.019075432792305946,
                  0.04892285540699959,
                  -0.05049469321966171,
                  -0.06638038158416748,
                  -0.034894589334726334,
                  -0.07579110562801361,
                  0.023911284282803535,
                  0.06164054945111275,
                  0.011198104359209538,
                  -0.014115228317677975,
                  0.034364961087703705,
                  0.041008058935403824,
                  0.046185631304979324,
                  -0.03740708529949188,
                  0.01983248069882393,
                  -0.0011977649992331862,
                  0.09629949182271957,
                  -0.05939787998795509,
                  0.005474538076668978,
                  0.08225927501916885,
                  -0.043168820440769196,
                  -0.042931728065013885,
                  -0.012860642746090889,
                  -0.015068882144987583,
                  0.024938464164733887,
                  0.05992195010185242,
                  0.02395036071538925,
                  0.04120722413063049,
                  -0.007837202399969101,
                  0.02755286544561386,
                  -0.01237569097429514,
                  0.017718076705932617,
                  -0.03748251125216484,
                  -0.03321954235434532,
                  0.042346809059381485,
                  -0.021877722814679146,
                  -0.04519161954522133,
                  -0.00986460130661726,
                  -0.033853914588689804,
                  -0.020009515807032585,
                  0.01711747981607914,
                  0.023703884333372116,
                  0.028201378881931305,
                  -0.04868583381175995,
                  -0.017634034156799316,
                  -0.04360968992114067,
                  -0.0059247249737381935,
                  -0.019730636849999428,
                  -0.056530945003032684
                ]
              }
            }
          }
        }
      ],
      "score_mode": "multiply",
      "max_boost": 3.4028235e+38,
      "boost": 1
    }
  },
  "_source": {
    "includes": [],
    "excludes": [
      "feature_vector"
    ]
  }
}

 

728x90
반응형

'Aqqle' 카테고리의 다른 글

[Aqqle] 회원관리  (0) 2024.08.10
[Aqqle] Aqqle API (상품 + 상점정보)  (0) 2023.10.29
[Aqqle] Aqqle 기획  (0) 2023.09.02