Skip to content

Commit

Permalink
delete DEFAULT_PARAMS
Browse files Browse the repository at this point in the history
  • Loading branch information
Kunihiko Kido committed Apr 24, 2015
1 parent 8b2c4c1 commit ebd54ab
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 29 deletions.
11 changes: 5 additions & 6 deletions elasticsearch_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

from .elasticsearch import ReusltJsonCommand
from .elasticsearch import make_path
from .elasticsearch import DEFAULT_PARAMS


class ElasticsearchDeleteDocumentCommand(ReusltJsonCommand):
Expand All @@ -25,7 +24,7 @@ def on_done(self, document_id):
return

path = make_path(self.index, self.doc_type, document_id)
self.request_delete(path, params=DEFAULT_PARAMS)
self.request_delete(path)


class ElasticsearchGetDocumentCommand(ReusltJsonCommand):
Expand All @@ -39,7 +38,7 @@ def on_done(self, document_id):
return

path = make_path(self.index, self.doc_type, document_id)
self.request_get(path, params=DEFAULT_PARAMS)
self.request_get(path)


class ElasticsearchIndexDocumentCommand(ReusltJsonCommand):
Expand All @@ -52,9 +51,9 @@ def on_done(self, document_id):
path = make_path(self.index, self.doc_type, document_id)
body = self.get_selection()
if document_id:
self.request_put(path, body=body, params=DEFAULT_PARAMS)
self.request_put(path, body=body)
else:
self.request_post(path, body=body, params=DEFAULT_PARAMS)
self.request_post(path, body=body)


class ElasticsearchUpdateDocumentCommand(ReusltJsonCommand):
Expand All @@ -68,4 +67,4 @@ def on_done(self, document_id):
return
path = make_path(self.index, self.doc_type, document_id, '_update')
body = self.get_selection()
self.request_post(path, body=body, params=DEFAULT_PARAMS)
self.request_post(path, body=body)
25 changes: 12 additions & 13 deletions elasticsearch_indices.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"""
from .elasticsearch import ReusltJsonCommand
from .elasticsearch import make_path
from .elasticsearch import DEFAULT_PARAMS


class ElasticsearchAnalyzeCommand(ReusltJsonCommand):
Expand All @@ -29,7 +28,7 @@ def run(self, request_body=False):
self.request_body = request_body
path = make_path(self.index)
body = self.request_body and self.get_selection() or None
self.request_put(path, body=body, params=DEFAULT_PARAMS)
self.request_put(path, body=body)


class ElasticsearchDeleteIndexCommand(ReusltJsonCommand):
Expand All @@ -41,7 +40,7 @@ def run(self):
return

path = make_path(self.index)
self.request_delete(path, params=DEFAULT_PARAMS)
self.request_delete(path)


class ElasticsearchDeleteMappingCommand(ReusltJsonCommand):
Expand All @@ -53,23 +52,23 @@ def run(self):
return

path = make_path(self.index, self.doc_type)
self.request_delete(path, params=DEFAULT_PARAMS)
self.request_delete(path)


class ElasticsearchGetSettingsCommand(ReusltJsonCommand):
result_window_title = "** Elasticsearch: Get Index Settings **"

def run(self):
path = make_path(self.index, '_settings')
self.request_get(path, params=DEFAULT_PARAMS)
self.request_get(path)


class ElasticsearchGetMappingCommand(ReusltJsonCommand):
result_window_title = "** Elasticsearch: Get Mapping **"

def run(self):
path = make_path(self.index, '_mapping', self.doc_type)
self.request_get(path, params=DEFAULT_PARAMS)
self.request_get(path)


class ElasticsearchPutMappingCommand(ReusltJsonCommand):
Expand All @@ -78,7 +77,7 @@ class ElasticsearchPutMappingCommand(ReusltJsonCommand):
def run(self):
path = make_path(self.index, '_mapping', self.doc_type)
body = self.get_selection()
self.request_put(path, body=body, params=DEFAULT_PARAMS)
self.request_put(path, body=body)


class ElasticsearchPutWarmerCommand(ReusltJsonCommand):
Expand All @@ -92,7 +91,7 @@ def on_done(self, name):
return
path = make_path(self.index, '_warmer', name)
body = self.get_selection()
self.request_put(path, body=body, params=DEFAULT_PARAMS)
self.request_put(path, body=body)


class ElasticsearchDeleteWarmerCommand(ReusltJsonCommand):
Expand All @@ -110,7 +109,7 @@ def on_done(self, warmer):
return

path = make_path(self.index, '_warmer', warmer)
self.request_delete(path, params=DEFAULT_PARAMS)
self.request_delete(path)


class ElasticsearchGetWarmerCommand(ReusltJsonCommand):
Expand All @@ -121,7 +120,7 @@ def run(self):

def on_done(self, name):
path = make_path(self.index, '_warmer', name)
self.request_get(path, params=DEFAULT_PARAMS)
self.request_get(path)


class ElasticsearchAddAliasCommand(ReusltJsonCommand):
Expand All @@ -134,7 +133,7 @@ def run(self, request_body=False):
def on_done(self, alias):
path = make_path(self.index, '_alias', alias)
body = self.request_body and self.get_selection() or None
self.request_put(path, body=body, params=DEFAULT_PARAMS)
self.request_put(path, body=body)


class ElasticsearchDeleteAliasCommand(ReusltJsonCommand):
Expand All @@ -152,7 +151,7 @@ def on_done(self, alias):
return

path = make_path(self.index, '_alias', alias)
self.request_delete(path, params=DEFAULT_PARAMS)
self.request_delete(path)


class ElasticsearchGetAliasCommand(ReusltJsonCommand):
Expand All @@ -163,4 +162,4 @@ def run(self):

def on_done(self, alias):
path = make_path(self.index, '_alias', alias)
self.request_get(path, params=DEFAULT_PARAMS)
self.request_get(path)
19 changes: 9 additions & 10 deletions elasticsearch_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from .elasticsearch import make_path
from .elasticsearch import make_choices
from .elasticsearch import choice
from .elasticsearch import DEFAULT_PARAMS

SEARCH_TYPE_CHOICES = (
('query_then_fetch', 'Search Type: Query Then Fetch (default)'),
Expand Down Expand Up @@ -76,7 +75,7 @@ class ElasticsearchBenchmarkCommand(ReusltJsonCommand):
def run(self):
path = make_path('_bench')
body = self.get_selection()
self.request_put(path, body=body, params=DEFAULT_PARAMS)
self.request_put(path, body=body)


class ElasticsearchDeletePercolatorCommand(ReusltJsonCommand):
Expand All @@ -94,7 +93,7 @@ def on_done(self, document_id):
return

path = make_path(self.index, '.percolator', document_id)
self.request_delete(path, params=DEFAULT_PARAMS)
self.request_delete(path)


class ElasticsearchExplainDocumentCommand(ReusltJsonCommand):
Expand All @@ -108,7 +107,7 @@ def on_done(self, document_id):
return
path = make_path(self.index, self.doc_type, document_id, '_explain')
body = self.get_selection()
self.request_post(path, body=body, params=DEFAULT_PARAMS)
self.request_post(path, body=body)


class ElasticsearchMatchPercolatorCommand(ReusltJsonCommand):
Expand All @@ -117,7 +116,7 @@ class ElasticsearchMatchPercolatorCommand(ReusltJsonCommand):
def run(self):
path = make_path(self.index, self.doc_type, '_percolate')
body = self.get_selection()
self.request_post(path, body=body, params=DEFAULT_PARAMS)
self.request_post(path, body=body)


class ElasticsearchRegisterPercolatorCommand(ReusltJsonCommand):
Expand All @@ -131,15 +130,15 @@ def on_done(self, document_id):
return
path = make_path(self.index, '.percolator', document_id)
body = self.get_selection()
self.request_put(path, body=body, params=DEFAULT_PARAMS)
self.request_put(path, body=body)


class ElasticsearchShowPercolatorCommand(ReusltJsonCommand):
result_window_title = "** Elasticsearch: Show Percolator **"

def run(self):
path = make_path(self.index, '.percolator', '_search')
self.request_get(path, params=DEFAULT_PARAMS)
self.request_get(path)


class ElasticsearchValidateQueryCommand(ReusltJsonCommand):
Expand All @@ -164,7 +163,7 @@ def on_done(self, template):

path = make_path('_search', 'template', template)
body = self.get_selection()
self.request_post(path, body=body, params=DEFAULT_PARAMS)
self.request_post(path, body=body)


class ElasticsearchDeleteSearchTemplateCommand(ReusltJsonCommand):
Expand All @@ -182,7 +181,7 @@ def on_done(self, template):
return

path = make_path('_search', 'template', template)
self.request_delete(path, body=None, params=DEFAULT_PARAMS)
self.request_delete(path, body=None)


class ElasticsearchGetSearchTemplateCommand(ReusltJsonCommand):
Expand All @@ -194,7 +193,7 @@ def run(self):
def on_done(self, template):
if template:
path = make_path('_search', 'template', template)
params = DEFAULT_PARAMS
params = None
else:
path = make_path('.scripts', '_search')
params = dict(_source='false')
Expand Down

0 comments on commit ebd54ab

Please sign in to comment.