| °í¹« Django Supportrubber°¡ÀÖ´Â Elasticsearch Ŭ¶óÀ̾ðÆ®´Â Elasticsearch ¿ë ÆÄÀ̽ã Ŭ¶óÀ̾ðÆ®ÀÔ´Ï´Ù. |
Áö±Ý ´Ù¿î·Îµå |
°í¹« ¼øÀ§ ¹× ¿ä¾à
- °Ô½ÃÀÚ À̸§:
- Stephane JAIS
- °Ô½ÃÀÚ À¥»çÀÌÆ®:
- https://github.com/cantinasoftware/
°í¹« ű×
°í¹« ¼³¸í
°í¹«´Â elasticsearch¸¦À§ÇÑ ÆÄÀ̽ã Ŭ¶óÀ̾ðÆ®ÀÔ´Ï´Ù. PIP ¼³Ä¡ RubberUsageBasic »ç¿ë °¡Á® ¿À±â °í¹« Ŭ¶óÀ̾ðÆ® = Rubber.ElasticSearch ( '±â»ç', '±â»ç') # client.search ({ 'query': { 'term': { ') »ç¿ëÀÚ ':'kimshy '}}}). HITS : PRINT HIT.SOURCE.USER # ¸ÅÇÎ client.mapping.put (my_mapping) # my_mappingÀº dict object.mapping.delete () mapping = client.mapping.get ( ) Django Integration Django.db °¡Á® ¿À±â ¸ðµ¨ Ŭ·¡½º ±â»ç (Models.Model)¿¡¼ °í¹« °¡Á® ¿À±â : ElasticSearch = rubber.elasticsearch () title = models.charfield (max_length = 255) content = models.textfield () # °Ë»ö ÀÀ´ä = article.elasticsearch .search (Query) # Äõ¸®´Â Dict # ¸ÅÇÎ inter.put (¸ÅÇÎ) # ¸ÅÇÎÀº DICT # ÀÚµ¿ ÀúÀå A = ±â»ç (TITLE = ''I Love es ') a.save () # ÀÚµ¿À¸·Î Àü¼ÛµË´Ï´Ù. elasticsearch a.delete () # elasticsearchConfigurationDisabl¿¡¼ ÀÚµ¿À¸·Î Á¦°Å µÈ Django ¸ðµ¨ÀÇ ÀÚµ¿ ÀúÀå µ¿ÀÛÀ» Django.db °¡Á® ¿À±â ¸ðµ¨ Ŭ·¡½º ±â»ç¿¡¼ °¡Á® ¿À±â °í¹« (models.model) : elasticsearch = rubber.elasticsearch (auto_index = false) title = models.charfield (max_length = 255) content = models.textfield () Django ¸ðµ¨ÀÇ »öÀÎ À̸§ ¹× ¹®¼ À¯Çü ±¸¼º Django.db °¡Á® ¿À±â °í¹« ¸ðµ¨ Ŭ·¡½º ±â»ç (MODELS.MODEL) : ELASTICSEARCH = RUBBERS.ELASTICSEARCH (index_name = 'custom_index', type = 'custom_type') ¿©·¯ Áö¼ö¿¡ ÀúÀå Django.db °¡Á® ¿À±â ¸ðµ¨ Ŭ·¡½º ±â»ç (models.model)¿¡¼ °í¹« °¡Á® ¿À±â : index1 = °í¹« . eLasticSearch (index_name = 'index1', type = 'type1') index2 = lubber.elasticsearch (index_name = 'index2', type = 'type2') Á¦Ç°ÀÇ È¨ÆäÀÌÁö
°í¹« °ü·Ã ¼ÒÇÁÆ®¿þ¾î