Skip to content

Commit

Permalink
added Apache Bench for Search Template Query
Browse files Browse the repository at this point in the history
  • Loading branch information
Kunihiko Kido committed Apr 14, 2015
1 parent d668d07 commit 0641155
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
1 change: 1 addition & 0 deletions Default.sublime-commands
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
{"command": "switch_servers", "caption": "Elasticsearch: Switch Servers"},
{"command": "show_active_server", "caption": "Elasticsearch: Show Active Server"},
{"command": "apache_bench", "caption": "Elasticsearch: Apache Bench"},
{"command": "search_template_apache_bench", "caption": "Elasticsearch: Apache Bench (for Search Template)"},
{"command": "open_file", "caption": "Elasticsearch: User File Settings", "args": {"file": "${packages}/User/Elasticsearch.sublime-settings"}},
{"command": "open_url", "caption": "Elasticsearch: Open Elasticsearch Reference", "args": {"url": "http://www.elastic.co/guide/en/elasticsearch/reference/current/index.html"}},
{"command": "search_docs", "caption": "Elasticsearch: Search in Docs"}
Expand Down
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,14 +206,15 @@ Elasticsearch: Cat Segments | GET | ``/_cat/segments``

### Utility Commands

Command | Descrption
-------------------------------------- | -------------------------
Elasticsearch: Apach Bench | Run Benchmark.
Elasticsearch: Open Reference | Open Elasticsearch Reference Webpage
Elasticsearch: Show Active Server | Show active server settings in a panel.
Elasticsearch: Switch Servers | Change the active server.
Elasticsearch: User File Settings | Shortcut. ``Preferences > Package Settings > ElasticsearchClient > Settings – User`` menu
Elasticsearch: Search in Docs | Site Search
Command | Descrption
------------------------------------------------ | -------------------------
Elasticsearch: Apach Bench | Run Benchmark.
Elasticsearch: Apach Bench (for Search Template) | Run Benchmark for Search Template Query.
Elasticsearch: Open Reference | Open Elasticsearch Reference Webpage
Elasticsearch: Show Active Server | Show active server settings in a panel.
Elasticsearch: Switch Servers | Change the active server.
Elasticsearch: User File Settings | Shortcut. ``Preferences > Package Settings > ElasticsearchClient > Settings – User`` menu
Elasticsearch: Search in Docs | Site Search


## Snippets for Queries
Expand Down
12 changes: 11 additions & 1 deletion elasticsearch_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ def run_apache_bench(self, path,

self.run_command(command)

def make_path(self):
return make_path(self.index, self.doc_type, '_search')

def on_done(self, index):
if index == -1:
return
Expand All @@ -74,11 +77,18 @@ def on_done(self, index):
benchmark = self.benchmarks[selected]
requests = str(benchmark.get('requests'))
concurrency = str(benchmark.get('concurrency'))
path = make_path(self.index, self.doc_type, '_search')
path = self.make_path()
postfile = self.get_file_name()
self.run_apache_bench(path, requests, concurrency, postfile)


class SearchTemplateApacheBenchCommand(ApacheBenchCommand):
""" Apache Bentch for Search Template Query """

def make_path(self):
return make_path(self.index, self.doc_type, '_search', 'template')


class AutoPrettyFormat(sublime_plugin.EventListener):

def on_pre_save(self, view):
Expand Down

0 comments on commit 0641155

Please sign in to comment.