This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| curl -XPUT 'localhost:9200/medium/blog/1' -d '{ | |
| "title": "Elasticsearch 特徴まとめ", | |
| "description": "Elasticsearch Features — 主にシステムを中心とした特徴まとめ", | |
| "creator": "Kunihiko Kido", | |
| "link": "https://medium.com/hello-elasticsearch/elasticsearch-500996e47c70", | |
| "tags": ["Elasticsearch"], | |
| "pubDate": "2014-03-12T11:09" | |
| }' | |
| curl -XPUT 'localhost:9200/medium/blog/2' -d '{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| from __future__ import print_function, unicode_literals | |
| import json | |
| import boto3 | |
| import logging | |
| from elasticsearch import Elasticsearch | |
| from elasticsearch import helpers | |
| from elasticsearch.exceptions import ElasticsearchException |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "category": "サッカー", | |
| "query": { | |
| "bool": { | |
| "should": [{ | |
| "simple_query_string": { | |
| "fields": ["text"], | |
| "default_operator": "or", | |
| "query": "\"サッカー\" " | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "took": 8883, | |
| "timed_out": false, | |
| "_shards": { | |
| "total": 90, | |
| "successful": 90, | |
| "failed": 0 | |
| }, | |
| "hits": { | |
| "total": 2811, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "query": { | |
| "bool": { | |
| "must": [{ | |
| "simple_query_string": { | |
| "query": "\"サッカー\"", // 1) 人が与える任意の分類・キーワード | |
| "fields": ["text"] // 2) 検索対象フィールド | |
| } | |
| }], | |
| "filter": [{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "doc": { | |
| "text": "スターウォーズのスター・デストロイヤー型ドローン動画が話題に" | |
| }, | |
| "aggs": { | |
| "categories": { | |
| "terms": { | |
| "field": "category" | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "took": 10, | |
| "_shards": { | |
| "total": 5, | |
| "successful": 5, | |
| "failed": 0 | |
| }, | |
| "total": 1, | |
| "matches": [], | |
| "aggregations": { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| from django.contrib import admin | |
| from django.http import HttpResponse | |
| class OwnerPermissionAdmin(admin.ModelAdmin): | |
| def queryset(self, request): | |
| qs = super(OwnerPermissionAdmin, self).queryset(request) | |
| if request.user.is_superuser: | |
| return qs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import sys | |
| sys.setdefaultencoding('utf-8') |
OlderNewer
