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

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

A6ad06db0fdd12a69bd2a92e8280247e?s=47 Kunihiko Kido
February 22, 2016

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

A6ad06db0fdd12a69bd2a92e8280247e?s=128

Kunihiko Kido

February 22, 2016
Tweet

Transcript

  1. %FWFMPQFST*0 $ Ϋϥεϝιουגࣜձࣾɹ໦ށࠃ඙ ⡥$MBTTNFUIPE *OD ೥݄೔ &MBTUJDTFBSDIͰɺ ࣗ༝ࣗࡏʹݕࡧɾ෼ੳ Ͱ͖ΔΑ͏ʹͳΔͨΊͷώϯτ 

  2. ࣗݾ঺հ  ⡥$MBTTNFUIPE *OD ໦ށࠃ඙! Ϋϥεϝιουגࣜձࣾɹ"84ίϯαϧςΟϯά෦ ೖࣾ̎̌೔໨ ੡඼։ൃνʔϜʹϓϩμΫτΦʔφʔͱ͍͏໾ׂͰ݄̎̍ ೔͔ΒδϣΠϯ͠·ͨ͠ɻ·ͩ·ͩΘ͔Βͳ͍͜ͱ͹͔ ΓͰ͕͢ΑΖ͓͘͠ئ͍͠·͢ɻN

    @@ N ϒϩάʮ)FMMP&MBTUJDTFBSDIʯ΋ΑΖ͓͘͠ئ͍͠·͢ ʲ޷͖ͳϓϩμΫτɺݴޠͳͲʳ
  3. ⡥$MBTTNFUIPE *OD  ΞδΣϯμ Α͋͘Δ೰Έ ݕࡧɾ෼ੳͷ࢓૊Έ "OBMZTJTϞδϡʔϧ ެࣜ"OBMZTJTϞδϡʔϧ ΧελϜ"OBMZ[FS "OBMZTJTͷίϯτϩʔϧ

    ݴޠॲཧύλʔϯ ϚϧνɾϑΟʔϧυ "1*T
  4. &MBTUJDTFBSDIͰɺࣗ༝ࣗ ࡏʹݕࡧɾ෼ੳͰ͖ΔΑ͏ ʹͳΔͨΊͷώϯτ !

  5. Α͋͘Δ೰Έ

  6. ⡥$MBTTNFUIPE *OD  ࢥͬͨΑ͏ʹ෼ੳ Ͱ͖ͳ͍ "

  7. ⡥$MBTTNFUIPE *OD  ࢥͬͨΑ͏ʹݕࡧ Ͱ͖ͳ͍ #

  8. ݕࡧɾ෼ੳͷ࢓૊Έ

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

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

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

    ೥   Ϋϥεϝιου     גࣜձࣾ      ςΫϊϩδʔ    %FWFMPQFST*0     5FSN $PVOU גࣜձࣾ  Ϋϥεϝιου  %FWFMPQFST*0  ςΫϊϩδʔ  ೥  "
  12. ⡥$MBTTNFUIPE *OD  ώϯτ ݕࡧ΋෼ੳ΋ࡧҾʢΠϯσοΫεʣ ΛͲ͏࡞Δ͔͕ॏཁ

  13. "OBMZTJTϞδϡʔϧ

  14. ⡥$MBTTNFUIPE *OD  \*OEFY^ \2VFSZ^ \%PDVNFOU^ */%&95*.& 4&"3$)5*.& "OBMZ[FS "OBMZ[FS͸ओʹೖྗ͞Εͨจࣈྻͷݴޠॲ

    ཧύΠϓϥΠϯॲཧΛఏڙ͠·͢ɻ ·ͨɺ"OBMZ[FSͰݴޠॲཧ͞ΕͨτʔΫϯ ୯ҐͰΠϯσοΫε͕࡞੒͞Ε·͢ɻ ΠϯσοΫεଆɿυΩϡϝϯτͷ಺༰ͷݴ ޠॲཧʹ࢖ΘΕ·͢ɻ αʔνଆɿݕࡧ࣌ͷೖྗΩʔϫʔυͷݴޠ ॲཧʹ࢖ΘΕ·͢ɻ "OBMZ[FS "OBMZ[FS $ #
  15. ⡥$MBTTNFUIPE *OD  "OBMZ[FSͷߏ੒ "OBMZ[FS͸ɺ$IBSBDUFS'JMUFSTɺ 5PLFOJ[FSɺ5PLFO'JMUFSTͷॲཧηοτ͔ Βߏ੒͞Ε͍ͯ·͢ɻ "OBMZ[FS͸ɺϑΟʔϧυ୯ҐʹॲཧΛ࣮ߦ ͠·͢ɻ \$IBSBDUFS'JMUFST^\5PLFOJ[FS^

    \5PLFO'JMUFST^ 5{\^\^\^{\^{\^\^\^{5` %"OBMZ[FS 1JQFMJOF1SPDFTTJOH
  16. ⡥$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
  17. ⡥$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
  18. ⡥$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
  19. ⡥$MBTTNFUIPE *OD  ώϯτ "OBMZ[FS͸ϑΟʔϧυ୯ҐͰॲཧ ͞ΕΔ ΠϯσοΫεଆͱαʔνଆͰҟͳΔ "OBMZ[FS͕ඞཁʹͳΔέʔε΋͋ Δ

  20. ެࣜ"OBMZTJTϞδϡʔϧ

  21. ⡥$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  QFS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T QIPOFUJD  LVSPNPKJ@UPLFOJ[FS BOBMZTJTLVSPNPKJ  LVSPNPKJ@CBTFGPSN BOBMZTJTLVSPNPKJ  LVSPNPKJ@QBSU@PG@TQFFD I BOBMZTJTLVSPNPKJ  LVSPNPKJ@SFBEJOHGPSN BOBMZTJTLVSPNPKJ  LVSPNPKJ@TUFNNFS BOBMZTJTLVSPNPKJ  KB@TUPQ BOBMZTJT LVSPNPKJ  QPMJTI@TUFN BOBMZTJT TUFNQFM  TNBSUDO@XPSE BOBMZTJTTNBSUDO  TNBSUDO@TFOUFODF BOBMZTJTTNBSUDO  JDV@OPSNBMJ[FS BOBMZTJTJDV  JDV@GPMEJOH BOBMZTJT JDV  JDV@DPMMBUJPO BOBMZTJT JDV  JDV@USBOTGPSN BOBMZTJT JDV
  24. ⡥$MBTTNFUIPE *OD  5PUBM

  25. ⡥$MBTTNFUIPE *OD  ώϯτ ඞཁͳ"OBMZTJT͸΄ͱΜͲἧͬͯ Δ ΄ͱΜͲͷެࣜ"OBMZTJTϞδϡʔ ϧ͸ઃఆΛΧελϚΠζՄೳ

  26. ΧελϜ"OBMZ[FS

  27. ⡥$MBTTNFUIPE *OD ΧελϜ"OBMZ[FSͱ͸ʁ 5PLFOJ[FS΍$IBSBDUFSpMUFSTɺ5PLFOpMUFSTΛ૊Έ߹Θͤͯɺಠࣗͷݕࡧཁ ݅΍ɺ෼ੳཁ݅Λ࣮ݱ͢ΔͨΊͷ"OBMZ[FSΛఆٛ͢Δ࢓૊ΈͰ͢ɻ  PUT /my_index { "settings":

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

    %PD %PD %PD 'JFME 'JFME 'JFME 'JFME 'JFME 'JFME 'JFME 'JFME ఆٛ ద༻ ࣮ߦ ˞/PEFϨϕϧͰ΋ఆٛՄೳͰ͕͢ɺجຊతʹ͸*OEFYϨϕϧͰఆٛ͠·͠ΐ͏ɻ
  29. ⡥$MBTTNFUIPE *OD  ώϯτ ΧελϜ"OBMZ[FS͸"OBMZTJT ϞδϡʔϧΛࣗ༝ʹ૊ΈΘͤͯઃఆ Ͱ͖Δ ·ͣ͸ɺެࣜ"OBMZTJTϞδϡʔϧ ͚ͩͰΧελϜ"OBMZ[FSΛઃܭ ΠϯσοΫεϨϕϧͰఆٛ͢Δ

    ϓϥάΠϯͷ։ൃ͸࠷ऴखஈ
  30. "OBMZTJTͷίϯτϩʔϧ

  31. ⡥$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Ͱఆٛ͞ΕͨEFGBVMU 45&1/PEFͰఆٛ͞ΕͨEFGBVMU@TFBSDI 45&1/PEF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EBSE "OBMZ[FS σϑΥϧτΞφϥΠβʔ ϤʔϩούܥݴޠΛݕࡧ͢ΔͨΊͷΞφϥ ΠβʔͰ͢ɻ ೔ຊޠ΋ҰԠݕࡧ͢Δ͜ͱ͸Ͱ͖·͕͢ɺ ׽ࣈɾͻΒ͕ͳ͸6OJHSBNͰΠϯσοΫε

    ͞ΕΔͨΊɺݕࡧ݁Ռͷద߹཰͸Լ͕Δ܏ ޲ʹ͋Γ·͢ɻΧλΧφ͸۠੾ΒΕͳ͍ͨΊ ࠶ݱ཰͕Լ͕Δ܏޲
  39. ⡥$MBTTNFUIPE *OD  ύολʔϯநग़ ྫ͑͹ɺ63-ͷσʔλϑΟʔϧυΛ࢖ͬͯɺυϝΠϯ ໊Ͱूܭ͍ͨ͠ lIUUQDMBTTNFUIPEKQDPNQBOZl lDMBTTNFUIPEKQz ਖ਼نදݱͰύολʔϯநग़

  40. ⡥$MBTTNFUIPE *OD  Ϛοϐϯά ྫ͑͹ɺ౎ಓ෎ݝ໊Λؔ౦ͳͲΤϦΞͰूܭ͍ͨ͠ l౦ژ౎l lؔ౦z ܾ·ͬͨ୯ޠͰஔ͖׵͑

  41. ⡥$MBTTNFUIPE *OD  ܗଶૉղੳ ྫ͑͹ɺ೔ຊޠΛର৅ʹͨ͠ݕࡧͰɺద߹཰Λ޲্͠ ͍ͨ l೥࠷৽ͷࣄྫ΍ςΫϊϩδʔ͕Ұಊ ʹձ͢ΔΠϕϯτ%FWFMPQFST*0։ ࠵͕ܾఆʂz lz

    l೥z l࠷৽z lࣄྫz lςΫϊϩ δʔz lҰಊz lձz l͢Δz lΠϕϯτz  l%FWFMPQFSTz l*0z lz l։࠵z lܾ ఆz ೔ຊޠͷ୯ޠ୯ҐʹτʔΫϯԽ
  42. ⡥$MBTTNFUIPE *OD  /(SBN ྫ͑͹ɺ೔ຊޠΛର৅ʹͨ͠ݕࡧͰɺ࠶ݱ཰Λ޲্͠ ͍ͨ l೥࠷৽ͷࣄྫ΍ςΫϊϩδʔ͕Ұಊ ʹձ͢ΔΠϕϯτ%FWFMPQFST*0։ ࠵͕ܾఆʂz 

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

     ೥࠷ ࠷৽ ৽ͷ ͷࣄ ྫ ΍ ΍ς ςΫ Ϋϊ ϊϩ ϩδ  δʔ ʔ͕ ͕Ұ Ұಊ ಊʹ ʹձ  ձ͢ ͢Δ ΔΠ Πϕ ϕϯ ϯτ  EFWFMPQFSTJP  ։࠵ ࠵͕  ͕ܾ ܾఆ $+,ͷΈ/จࣈ୯ҐʹτʔΫϯԽ
  44. ⡥$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  ࢦఆൣғͷจࣈ਺ͰτʔΫϯԽ
  45. ⡥$MBTTNFUIPE *OD  5PLFO/(SBN ྫ͑͹ɺ୯ޠͷ૊Έ߹ΘͤΛநग़͍ͨ͠ l೥࠷৽ͷࣄྫ΍ςΫϊϩδʔ͕Ұಊ ʹձ͢ΔΠϕϯτ%FWFMPQFST*0։ ࠵͕ܾఆʂz ࠷৽ࣄྫ ࣄྫςΫϊϩδʔ

    ςΫϊ ϩδʔҰಊ Ұಊձ ձΠϕϯτ Π ϕϯτEFWFMPQFST EFWFMPQFSTJP τʔΫϯΛϑϨʔζԽ
  46. ⡥$MBTTNFUIPE *OD  ύολʔϯநग़ ྫ͑͹ɺ63-ͷσʔλϑΟʔϧυΛ࢖ͬͯɺυϝΠϯ ໊͔Β೔ຊޠձ໊ࣾͰूܭද͍ࣔͨ͠ lIUUQDMBTTNFUIPEKQDPNQBOZl lDMBTTNFUIPEKQz ਖ਼نදݱͰύολʔϯநग़ Ϛοϐϯά

    ܾ·ͬͨ୯ޠͰஔ͖׵͑ lΫϥεϝιουגࣜձࣾz
  47. ⡥$MBTTNFUIPE *OD  &EHF/(SBN ྫ͑͹ɺ೔ຊޠͷจষʹରͯ͠Πϯελϯτݕࡧͨ͠ ͍ɻʢ(PPHMFͷΠϯελϯτݕࡧʣ l೥࠷৽ͷࣄྫ΍ςΫϊϩδʔ͕Ұಊ ʹձ͢ΔΠϕϯτ%FWFMPQFST*0։ ࠵͕ܾఆʂz 

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

    ࠷৽ ࠷৽ ࠷৽ࣄ ࠷৽ࣄྫ  ࣄ ࣄྫ ࣄྫς ࣄྫςΫ ࣄ ྫςΫϊ ࣄྫςΫϊϩ ࣄྫςΫϊ ϩδ ࣄྫςΫϊϩδʔz  ϑϨʔζΛࢦఆൣғͷจࣈ਺ͰτʔΫϯԽ ܗଶૉղੳ &EHF/(SBN ܗଶૉղੳͰ୯ޠ୯ҐʹτʔΫϯΜԽ ୯ޠΛϑϨʔζ୯ʹτʔΫϯԽ
  49. ⡥$MBTTNFUIPE *OD  ΫϥελϦϯά ྫ͑͹ɺෳ਺ͷଐੑͷ஋Λ࢖ͬͯυΩϡϝϯτΛΫϥ ελϦϯά͍ͨ͠ \2VFSJFT^ \%PDVNFOU^ 1FSDPMBUF"1* ݕࡧ৚݅Λࣄલʹొ࿥͓͖ͯ͠ɺ೚ҙͷυΩϡϝϯ

    τʹϚον͢Δݕࡧ৚݅Λநग़͢Δಛघͳ࢓૊Έ SFRVFTU NBUDIRVFSJFT NFUB
  50. ⡥$MBTTNFUIPE *OD  ώϯτ σʔλͷ಺༰Λ೺Ѳ ݕࡧɾ෼ੳཁ݅Λ೺Ѳ ·ͣ͸OPU@BOBMZ[FEઃఆՄೳ͔Ͳ ͏͔ݕ౼ ݴޠॲཧύλʔϯΛϕʔεʹߟ͑Δ ݴޠॲཧύλʔϯͷ૊Έ߹ΘͤͯΈΔ

  51. ϚϧνɾϑΟʔϧυ

  52. .VMUJ'JFME ⡥$MBTTNFUIPE *OD ϚϧνɾϑΟʔϧυ  UJUMF ܗଶૉղੳ"OBMZ[FS UJUMFTZOPOZN ܗଶૉղੳ 4ZOPOZN

    "OBMZ[FS UJUMFTVCTUSJOH /(SBN"OBMZ[FS UJUMFUPQJD τϐοΫநग़"OBMZ[FS ݩσʔλͷεΩʔϚΛมߋͤͣʹ༻్ͷҟͳΔ"OBMZ[FSΛಉ ͡ϑΟʔϧυʹରͯ͠ෳ਺ఆٛ͢Δ͜ͱ͕Ͱ͖Δ࢓૊Έ
  53. ⡥$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" } } } } } } } ϚϧνɾϑΟʔϧυ
  54. ⡥$MBTTNFUIPE *OD  ώϯτ ݩυΩϡϝϯτͷߏ଄Λมߋ͢Δલ ʹϚϧνɾϑΟʔϧυͰରԠՄೳ͔ ݕ౼ ϚϧνɾϑΟʔϧυͷ໊শΛඪ४Խ

  55. "1*T

  56. *OEJDFT"1*T 

  57. ⡥$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 ...} }
  58. ⡥$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
  59. ⡥$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
  60. ⡥$MBTTNFUIPE *OD (FU.BQQJOH(FU'JFME.BQQJOH"1* ݱࡏઃఆ͞Ε͍ͯΔ.BQQJHఆٛΛऔಘ͢ΔͨΊͷ"1*Ͱ͢ɻϑΟʔϧυ ͷܕ΍ਖ਼͍͠"OBMZ[FS͕ઃఆ͞Ε͍ͯΔ͔ͳͲ֬ೝ͢Δ͜ͱ͕Ͱ͖·͢ɻ  GET /my_index/_mapping/my_type { "my_index":

    { "mappings": { "my_type": { "properties": { "user": { "type": "string" } } } } } } SFTVMU SFRVFTU
  61. 4FBSDI"1*T 

  62. ⡥$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
  63. ⡥$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
  64. ⡥$MBTTNFUIPE *OD  ώϯτ ͍Ζ͍Ζศརͳ"1*Λ׆༻ "OBMZ[FSͷݕূ͸σʔλΛΠϯ σοΫε͠ͳͯ͘΋ݕূͰ͖Δ

  65. ·ͱΊ

  66. ⡥$MBTTNFUIPE *OD ·ͱΊ w ެࣜͷ"OBMZTJTϞδϡʔϧͷ೺Ѳ w ϓϥάΠϯΛ։ൃ͢Δ͜ͱ΋Ͱ͖·͕͢ɺ·ͣ͸ެࣜͷ"OBMZTJTϞδϡʔϧΛ૊Έ߹Θ࣮ͤͯݱ Մೳ͔ݕ౼͍ͯͩ͘͠͞ɻ w σʔλͷ಺༰ͱݕࡧɾ෼ੳχʔζͷ೺Ѳ

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

  68. ⡥$MBTTNFUIPE *OD ࠂ஌ 

  69. %FWFMPQFST*0 ͝੩ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠ɻ εϥΠυ͸ޙ೔ϒϩάͰެ։͠·͢ɻ  $ ⡥$MBTTNFUIPE *OD #cmdevio2016