Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Developers.IO 2016 C-2 「Elasticsearchで自由自在に検索・分...

Developers.IO 2016 C-2 「Elasticsearchで自由自在に検索・分析できるようになるためのヒント」

Kunihiko Kido

February 22, 2016
Tweet

More Decks by Kunihiko Kido

Other Decks in Technology

Transcript

  1. ⡥$MBTTNFUIPE *OD  *OEFYJOHZPVSEBUB ݕࡧΤϯδϯ͸ɺݩͷσʔλΛͦͷ··อ ଘ͢ΔͷͰ͸ͳ͘ɺߴ଎ʹݕࡧͰ͖ΔΑ͏ ʹτʔΫϯ୯ҐͰΠϯσοΫεΛ࡞͍ͬͯ· ͢ɻ̍࡭ͷຊʹྫ͑ΔͳΒຊͷ຤ඌʹ͋Δࡧ ҾΛ࡞ΔΠϝʔδ ࡧҾ

    ೥   Ϋϥεϝιου     גࣜձࣾ      ςΫϊϩδʔ    %FWFMPQFST*0     l೥࠷৽ͷࣄྫ΍ςΫϊϩδʔ͕ Ұಊʹձ͢ΔΠϕϯτ%FWFMPQFST*0 ։࠵͕ܾఆʂz $
  2. ⡥$MBTTNFUIPE *OD  4FBSDIJOHZPVSEBUB ݕࡧͱ͸ɺ͋Β͔͡Ί࡞੒͞Ε͍ͯΔࡧҾʹ ରͯ͠ೖྗ͞ΕͨΩʔϫʔυ͕Ϛον͢Δυ Ωϡϝϯτநग़ͯ͠·͢ɻ (PPEʮ%FWFMPQFST*0ʯˠ'PVOE #BEʮEFWFMPQFSTʯˠ/PUGPVOE ࡧҾ

    ೥   Ϋϥεϝιου     גࣜձࣾ      ςΫϊϩδʔ    %FWFMPQFST*0     %FWFMPQFST*0      #
  3. ⡥$MBTTNFUIPE *OD  "OBMZ[JOHZPVSEBUB ࡧҾʢΠϯσοΫεʣͷτʔΫϯ͝ͱʹυ Ωϡϝϯτ਺Λूܭʢ5FSNT "HHSFHBUJPOʣ ͻΒ͕ͳ̍จࣈͰूܭ͞Εͯ͠·͏ͷ͸ɺࡧ ҾͻΒ͕ͳ̍จࣈͰ࡞ΒΕ͍ͯΔ͔Βɻ ࡧҾ

    ೥   Ϋϥεϝιου     גࣜձࣾ      ςΫϊϩδʔ    %FWFMPQFST*0     5FSN $PVOU גࣜձࣾ  Ϋϥεϝιου  %FWFMPQFST*0  ςΫϊϩδʔ  ೥  "
  4. ⡥$MBTTNFUIPE *OD  \*OEFY^ \2VFSZ^ \%PDVNFOU^ */%&95*.& 4&"3$)5*.& "OBMZ[FS "OBMZ[FS͸ओʹೖྗ͞Εͨจࣈྻͷݴޠॲ

    ཧύΠϓϥΠϯॲཧΛఏڙ͠·͢ɻ ·ͨɺ"OBMZ[FSͰݴޠॲཧ͞ΕͨτʔΫϯ ୯ҐͰΠϯσοΫε͕࡞੒͞Ε·͢ɻ ΠϯσοΫεଆɿυΩϡϝϯτͷ಺༰ͷݴ ޠॲཧʹ࢖ΘΕ·͢ɻ αʔνଆɿݕࡧ࣌ͷೖྗΩʔϫʔυͷݴޠ ॲཧʹ࢖ΘΕ·͢ɻ "OBMZ[FS "OBMZ[FS $ #
  5. ⡥$MBTTNFUIPE *OD  $IBSBDUFS'JMUFST $IBSBDUFS'JMUFS͸ɺओʹจࣈྻʹର͢Δ ਖ਼نԽॲཧΛ୲౰͢ΔॲཧεςʔδͰ͢ɻ ̍ͭͷ"OBMZ[FSʹ̌ݸҎ্ͷෳ਺ͷ $IBSBDUFS'JMUFSΛઃఆՄೳɻ ύΠϓϥΠϯͰॲཧ͞ΕΔͨΊͷॱ൪ʹ஫ҙ 5{

    \^\^\^ {\^{\^\^\^{5` 1JQFMJOF1SPDFTTJOH \$IBSBDUFS'JMUFST^\5PLFOJ[FS^ \5PLFO'JMUFST^ lI̎̌̍̒೥࠷৽ͷࣄྫ΍ũŞůƁŢƄŖ͕Ұಊʹձ͢ΔŘųƄƃŪ%FWFMPQFST ̞̤։࠵͕ܾఆʂIz l೥࠷৽ͷࣄྫ΍ςΫϊϩδʔ͕Ұಊʹձ͢ΔΠϕϯτ %FWFMPQFST*0։࠵͕ܾఆʂz ਖ਼نԽ %"OBMZ[FS
  6. ⡥$MBTTNFUIPE *OD  5PLFOJ[FS 5PLFOJ[FS͸$IBSBDUFS'JMUFSTͰॲཧ͞ ΕͨจࣈྻΛτʔΫϯԽ͢ΔͨΊͷॲཧε ςʔδͰ͢ɻ ̍ͭͷ"OBMZ[FSʹ̍ͭͷ"OBMZ[FSΛࢦఆ Մೳ 5{\^\^\^{

    \^ {\^\^\^{5` 1JQFMJOF1SPDFTTJOH \$IBSBDUFS'JMUFST^\5PLFOJ[FS^ \5PLFO'JMUFST^ l೥࠷৽ͷࣄྫ΍ςΫϊϩδʔ͕Ұಊʹձ͢ΔΠϕϯτ %FWFMPQFST*0։࠵͕ܾఆʂz lz l೥z l࠷৽z lͷz lࣄྫz l΍z lςΫϊϩδʔz l͕zlҰಊz lʹz  lձz l͢Δz lΠϕϯτz l%FWFMPQFSTz l*0z lz l։࠵z l͕z lܾఆz τʔΫϯԽ %"OBMZ[FS
  7. ⡥$MBTTNFUIPE *OD  5PLFO'JMUFST 5PLFO'JMUFS͸ɺ5PLFOJ[FSͰॲཧ͞Εͨ τʔΫϯΛ͞ΒʹՃ޻͢ΔͨΊͷॲཧεςʔ δͰ͢ɻ ̍ͭͷ"OBMZ[FSʹ̌ݸҎ্ͷෳ਺ͷ 5PLFO'JMUFSΛઃఆՄೳɻ ύΠϓϥΠϯͰॲཧ͞ΕΔͨΊͷॱ൪ʹ஫ҙ

    5{\^\^\^{\^{ \^\^\^ {5` 1JQFMJOF1SPDFTTJOH \$IBSBDUFS'JMUFST^\5PLFOJ[FS^ \5PLFO'JMUFST^ lz l೥z l࠷৽z lͷz lࣄྫz l΍z lςΫϊϩδʔz l͕zlҰಊz lʹz  lձz l͢Δz lΠϕϯτz l%FWFMPQFSTz l*0z lz l։࠵z l͕z lܾఆz lz l࠷৽z lࣄྫz lςΫϊϩδʔz lҰಊz lΠϕϯτz l%FWFMPQFSTz  l*0z lz l։࠵z lܾఆz Ճ޻ %"OBMZ[FS
  8. ⡥$MBTTNFUIPE *OD   "OBMZ[FST  TUBOEBSE  TJNQMF 

    XIJUFTQBDF  TUPQ  LFZXPSE  QBUUFSO  TOPXCBMM  BSBCJD MBOHVBHF   BSNFOJBO MBOHVBHF  CBTRVF MBOHVBHF  CSB[JMJBO MBOHVBHF  CVMHBSJBO MBOHVBHF  DBUBMBO MBOHVBHF  DKL MBOHVBHF  D[FDI MBOHVBHF  EBOJTI MBOHVBHF  EVUDI MBOHVBHF  FOHMJTI MBOHVBHF  pOOJTI MBOHVBHF  GSFODI MBOHVBHF  HBMJDJBO MBOHVBHF  HFSNBO MBOHVBHF  HSFFL MBOHVBHF  IJOEJ MBOHVBHF  IVOHBSJBO MBOHVBHF  JOEPOFTJBO MBOHVBHF  JSJTI MBOHVBHF  JUBMJBO MBOHVBHF  MBUWJBO MBOHVBHF  MJUIVBOJBO MBOHVBHF  OPSXFHJBO MBOHVBHF  QFSTJBO MBOHVBHF  QPSUVHVFTF MBOHVBHF  SPNBOJBO MBOHVBHF  SVTTJBO MBOHVBHF  TPSBOJ MBOHVBHF  TQBOJTI MBOHVBHF  TXFEJTI MBOHVBHF  UVSLJTI MBOHVBHF  UIBJ MBOHVBHF  LVSPNPKJ BOBMZTJTLVSPNPKJ  QPMJTI BOBMZTJTTUFNQFM  TNBSUDO BOBMZTJTTNBSUDO
  9. ⡥$MBTTNFUIPE *OD   $IBSBDUFS 'JMUFST  NBQQJOH  IUNM@TUSJQ

     QBUUFSO@SFQMBDF  LVSPNPKJ@JUFSBUJPO@NBSL BOBMZTJTLVSPNPKJ   JDV@OPSNBMJ[FS BOBMZTJTJDV
  10. ⡥$MBTTNFUIPE *OD   5PLFO'JMUFST  TUBOEBSE  BTDJJGPMEJOH 

    MFOHUI  MPXFSDBTF  VQQFSDBTF  O(SBN  FEHF/(SBN  QPSUFS@TUFN  TIJOHMF TUPQ XPSE@EFMJNJUFS TUFNNFS TUFNNFS@PWFSSJEF LFZXPSE@NBSLFS LFZXPSE@SFQ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݅Λ࣮ݱ͢ΔͨΊͷ"OBMZ[FSΛఆٛ͢Δ࢓૊ΈͰ͢ɻ  PUT /my_index { "settings":

    { "analysis": { "char_filter": { ... custom character filters ... }, "tokenizer": { ... custom tokenizers ... }, "filter": { ... custom token filters ... }, "analyzer": { ... custom analyzers ... } } } }
  12. ⡥$MBTTNFUIPE *OD ΧελϜ"OBMZ[FSͷఆٛɾద༻ɾ࣮ߦ  *OEFY 5ZQF .BQQJOH 5ZQF .BQQJOH %PD

    %PD %PD %PD 'JFME 'JFME 'JFME 'JFME 'JFME 'JFME 'JFME 'JFME ఆٛ ద༻ ࣮ߦ ˞/PEFϨϕϧͰ΋ఆٛՄೳͰ͕͢ɺجຊతʹ͸*OEFYϨϕϧͰఆٛ͠·͠ΐ͏ɻ
  13. ⡥$MBTTNFUIPE *OD "OBMZ[FSܾఆϑϩʔ  45&1.BQQJOHͰఆٛ͞ΕͨJOEFY@BOBMZ[FS Y 45&1%PDVNFOUͰఆٛ͞Εͨ@BOBMZ[FS Y 45&15ZQFͰఆٛ͞ΕͨJOEFY@BOBMZ[FS Y

    45&1*OEFYͰఆٛ͞ΕͨEFGBVMU@JOEFY Y 45&14UBOEBSE"OBMZ[FS 45&1.BQQJOHͰఆٛ͞ΕͨBOBMZ[FS 45&15ZQFͰఆٛ͞ΕͨBOBMZ[FS Y 45&1*OEFYͰఆٛ͞ΕͨEFGBVMU 45&1/PEFͰఆٛ͞ΕͨEFGBVMU@JOEFY Y 45&1/PEFͰఆٛ͞ΕͨEFGBVMU 45&12VFSZͰ໌ࣔతʹࢦఆ͞ΕͨBOBMZ[FS 45&15ZQFͰఆٛ͞ΕͨTFBSDI@BOBMZ[FS Y 45&1*OEFYͰఆٛ͞ΕͨEFGBVMU@TFBSDI 45&14UBOEBSE"OBMZ[FS 45&1.BQQJOHͰఆٛ͞ΕͨTFBSDI@BOBMZ[FS 45&15ZQFͰఆٛ͞ΕͨBOBMZ[FS Y 45&1*OEFYͰఆٛ͞Ε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z lܾ ఆz ೔ຊޠͷ୯ޠ୯ҐʹτʔΫϯԽ
  17. ⡥$MBTTNFUIPE *OD  /(SBN ྫ͑͹ɺ೔ຊޠΛର৅ʹͨ͠ݕࡧͰɺ࠶ݱ཰Λ޲্͠ ͍ͨ l೥࠷৽ͷࣄྫ΍ςΫϊϩδʔ͕Ұಊ ʹձ͢ΔΠϕϯτ%FWFMPQFST*0։ ࠵͕ܾఆʂz 

      ೥ ೥࠷ ࠷৽ ৽ ͷ ͷࣄ ྫ΍ ΍ς ςΫ Ϋϊ  ϊϩ ϩδ δʔ ʔ͕ ͕Ұ Ұಊ  ಊʹ ʹձ ձ͢ ͢Δ ΔΠ Πϕ  ϕϯ ϯτ ϯE EF FW WF  FM MP PQ QF FS ST T J  JP J    ։ ։࠵  ࠵͕ ͕ܾ ܾఆ /จࣈ୯ҐʹτʔΫϯԽ
  18. ⡥$MBTTNFUIPE *OD  $+,#JHSBN ྫ͑͹ɺӳɾ਺ࣈࠞ͡Γͷ೔ຊޠͷจষΛର৅ʹɺӳɾ ਺ࣈͷݕࡧͷద߹཰͸Լ͛ͣʹɺ೔ຊޠʢͻΒͳ͕ͳɺ ΧλΧφɺ׽ࣈʣͷ࠶ݱ཰Λ޲্͍ͤͨ͞ l೥࠷৽ͷࣄྫ΍ςΫϊϩδʔ͕Ұಊ ʹձ͢ΔΠϕϯτ%FWFMPQFST*0։ ࠵͕ܾఆʂz

     ೥࠷ ࠷৽ ৽ͷ ͷࣄ ྫ ΍ ΍ς ςΫ Ϋϊ ϊϩ ϩδ  δʔ ʔ͕ ͕Ұ Ұಊ ಊʹ ʹձ  ձ͢ ͢Δ ΔΠ Πϕ ϕϯ ϯτ  EFWFMPQFSTJP  ։࠵ ࠵͕  ͕ܾ ܾఆ $+,ͷΈ/จࣈ୯ҐʹτʔΫϯԽ
  19. ⡥$MBTTNFUIPE *OD  &EHF/(SBN ྫ͑͹ɺΩʔϫʔυ΍੡඼໊ͳͲଟগͷ༳Β͗Λٵऩ ͭͭ͠લํҰகͰݕࡧ͍ͨ͠ɻʢΩʔϫʔυαδΣε τʣ l%FWFMPQFST*0z E EF

    EFW EFWF EFWFM  EFWFMP EFWFMPQ EFWFMPQF  EFWFMPQFS EFWFMPQFST  EFWFMPQFST EFWFMPQFSTJ  EFWFMPQFSTJP EFWFMPQFSTJP  EFWFMPQFSTJP EFWFMPQFSTJP  EFWFMPQFSTJP EFWFMPQFSTJP  ࢦఆൣғͷจࣈ਺ͰτʔΫϯԽ
  20. ⡥$MBTTNFUIPE *OD  &EHF/(SBN ྫ͑͹ɺ೔ຊޠͷจষʹରͯ͠Πϯελϯτݕࡧͨ͠ ͍ɻʢ(PPHMFͷΠϯελϯτݕࡧʣ l೥࠷৽ͷࣄྫ΍ςΫϊϩδʔ͕Ұಊ ʹձ͢ΔΠϕϯτ%FWFMPQFST*0։ ࠵͕ܾఆʂz 

       ࠷ ࠷৽ ࣄ  ࣄྫ ς ςΫ ςΫϊ ςΫϊϩ  ςΫϊϩδ ςΫϊϩδʔ Ұ Ұಊ  ձ Π Πϕ Πϕϯ lΠϕϯτz ୯ޠ͝ͱʹࢦఆൣғͷจࣈ਺ͰτʔΫϯԽ ܗଶૉղੳ ܗଶૉղੳͯ͠୯ޠ୯ҐʹτʔΫϯԽ
  21. ⡥$MBTTNFUIPE *OD  5PLFO/(SBN ྫ͑͹ɺ೔ຊޠͷίϯςϯπ͔ΒϑϨʔζΛநग़ͯ͠ ͦΕΛΩʔϫʔυαδΣετͰ࢖͍͍ͨ l೥࠷৽ͷࣄྫ΍ςΫϊϩδʔ͕Ұಊ ʹձ͢ΔΠϕϯτ%FWFMPQFST*0։ ࠵͕ܾఆʂz ࠷

    ࠷৽ ࠷৽ ࠷৽ࣄ ࠷৽ࣄྫ  ࣄ ࣄྫ ࣄྫς ࣄྫςΫ ࣄ ྫςΫϊ ࣄྫςΫϊϩ ࣄྫςΫϊ ϩδ ࣄྫςΫϊϩδʔz  ϑϨʔζΛࢦఆൣғͷจࣈ਺ͰτʔΫϯԽ ܗଶૉղੳ &EHF/(SBN ܗଶૉղੳͰ୯ޠ୯ҐʹτʔΫϯΜԽ ୯ޠΛϑϨʔζ୯ʹτʔΫϯԽ
  22. .VMUJ'JFME ⡥$MBTTNFUIPE *OD ϚϧνɾϑΟʔϧυ  UJUMF ܗଶૉղੳ"OBMZ[FS UJUMFTZOPOZN ܗଶૉղੳ 4ZOPOZN

    "OBMZ[FS UJUMFTVCTUSJOH /(SBN"OBMZ[FS UJUMFUPQJD τϐοΫநग़"OBMZ[FS ݩσʔλͷεΩʔϚΛมߋͤͣʹ༻్ͷҟͳΔ"OBMZ[FSΛಉ ͡ϑΟʔϧυʹରͯ͠ෳ਺ఆٛ͢Δ͜ͱ͕Ͱ͖Δ࢓૊Έ
  23. ⡥$MBTTNFUIPE *OD ϚϧνɾϑΟʔϧυͷఆٛྫ  PUT /my_index { "mappings": { "posts":

    { "properties": { "name": { "type": "string", "analyzer": "ja_analyzer", "fields": { "synonym": { "type": "string", "search_analyzer": "ja_analyzer", "analyzer": "ja_synonym_analyzer" }, "substring": { "type": "string", "analyzer": "substring_analyzer" }, "topic": { "type": "string", "search_analyzer": "keyword", "analyzer": "topic_analyzer" } } } } } } } ϚϧνɾϑΟʔϧυ
  24. ⡥$MBTTNFUIPE *OD *OEFY5FNQMBUFT"1* *OEFYΛ࡞੒͢ΔࡍͷςϯϓϨʔτͷ؅ཧΛ͢ΔͨΊͷ"1*Ͱ͢ɻ $VTUPN"OBMZ[FSͷఆٛ΍.BQQJHOఆٛͳͲ͸ɺ*OEFY5FNQMBUFT"1*Λ࢖ͬͯςϯϓ Ϩʔτొ࿥͓ͯ͘͠ͱɺΠϯσοΫε࡞੒࣌ʹ͍͍ͪͪઃఆΛ͠ͳͯ͘΋ྑ͍ͷͰศརͰ͢ɻ  PUT /_template/item_index_template {

    "template": "item*", "settings": { "analysis": { "char_filter": { ... custom character filters ... }, "tokenizer": { ... custom tokenizers ... }, "filter": { ... custom token filters ... }, "analyzer": { ... custom analyzers ... } } }, "mappings": { ... field mappings ...} }
  25. ⡥$MBTTNFUIPE *OD "OBMZ[F"1* ೚ҙͷจষΛ࢖ͬͯɺ"OBMZ[F͢Δ͜ͱ͕Ͱ͖Δ"1*Ͱ͢ɻ$VTUPN "OBMZ[FSΛઃఆͨ͠ࡍʹɺσʔλΛΠϯσοΫε͠ͳͯ͘΋ɺ͜ͷ"1* Λ࢖ͬͯ͋Δఔ౓ݕূ͢Δ͜ͱ͕Ͱ͖·͢ɻ  POST /my_index/_analyze?analyzer=standard Hello!

    Elasticsearch { "tokens": [ { "token": "hello", "start_offset": 0, "end_offset": 5, "type": "<ALPHANUM>", "position": 0 }, { "token": "elasticsearch", "start_offset": 7, "end_offset": 20, "type": "<ALPHANUM>", "position": 1 } ] SFRVFTU SFTVMU
  26. ⡥$MBTTNFUIPE *OD (FU4FUUJOHT"1* ΠϯσοΫεͷઃఆ৘ใΛऔಘ͢ΔͨΊͷ"1*Ͱ͢ɻ$VTUPN "OBMZ[FSͳͲͷఆٛ৘ใΛऔಘ͢Δ͜ͱ͕Ͱ͖·͢ɻ  GET /my_index/_settings { "my_index":

    { "settings": { "index": { "creation_date": "1455756138471", "number_of_shards": "5", "number_of_replicas": "1", "uuid": "PQ0f-0MlTtagrs- HeJHZ6Q", "version": { "created": "2020099" } } } } } SFRVFTU SFTVMU
  27. ⡥$MBTTNFUIPE *OD 7BMJEBUF"1*1SPpMF"1* 2VFSZ͕ਖ਼͍͠ॻࣜԽͲ͏͔ʁ·ͨɺΩʔϫʔυ͕ͲͷΑ͏ʹ"OBMZ[F ͞Εͯݕࡧ͍ͯ͠Δͷ͔ͳͲͷ৘ใΛऔಘ͢Δ͜ͱ͕Ͱ͖Δ"1*Ͱ͢ɻ  POST /my_index/my_type/_validate/query? explain=true {

    "query": { "match": { "user": "Kimchy" } } } { "valid": true, "_shards": { "total": 1, "successful": 1, "failed": 0 }, "explanations": [ { "index": "my_index", "valid": true, "explanation": "+user:kimchy #ConstantScore(+ConstantScore(_type:data))" } ] } SFRVFTU SFTVMU
  28. ⡥$MBTTNFUIPE *OD &YQMBJO"1* ೚ҙͷυΩϡϝϯτʹରͯ͠ɺ2VFSZ͕ͲͷΑ͏ʹϚον͍ͯ͠Δ͔ͳ Ͳͷ৘ใΛऔಘ͢Δ͜ͱ͕Ͱ͖·͢ɻ  POST /my_index/my_type/1/_explain { "query":

    { "match": { "user": "Kimchy" } } } { "_index": "my_index", "_type": "my_type", "_id": "1", "matched": true, "explanation": { "value": 0.5945348, "description": "sum of:", "details": [ { "value": 0.5945348, "description": "weight(user:kimchy in 0) [PerFieldSimilarity], result of:", "details": [ { "value": 0.5945348, SFTVMU SFRVFTU
  29. ⡥$MBTTNFUIPE *OD ·ͱΊ w ެࣜͷ"OBMZTJTϞδϡʔϧͷ೺Ѳ w ϓϥάΠϯΛ։ൃ͢Δ͜ͱ΋Ͱ͖·͕͢ɺ·ͣ͸ެࣜͷ"OBMZTJTϞδϡʔϧΛ૊Έ߹Θ࣮ͤͯݱ Մೳ͔ݕ౼͍ͯͩ͘͠͞ɻ w σʔλͷ಺༰ͱݕࡧɾ෼ੳχʔζͷ೺Ѳ

    w ͜Ε͕ͳ͍ͱઃܭͰ͖·ͤΜɻ w কདྷతͳχʔζ΋ؚΊͯઃܭͰ͖Δͱͳ͓ྑ͍Ͱ͢ɻ w ݴޠॲཧύλʔϯͷཧղ w ݴޠॲཧύλʔϯΛϕʔεʹɺ͋ͱ͸ϑΟϧλʔͳͲͰݸผʹ੍౓Λ্͍͖͛ͯ·͠ΐ͏ɻ w ςϯϓϨʔτԽ w ࢖༻͢ΔΧελϜ"OBMZ[FS΍.BQQJOHఆٛ͸ςϯϓϨʔτԽͯ͠࢖͍·ΘͤΔΑ͏ʹ͠·͠ΐ ͏ɻ w "1*Λ࢖͍͜ͳ͢ w ͍Ζ͍Ζ"1*͕͋ΔͷͰɺ͜ΕΒΛ࢖ͬͯઃܭɾݕূΛޮ཰Խ͠·͠ΐ͏ɻ