├── .gitignore ├── .java-version ├── .ruby-gemset ├── .ruby-version ├── Gemfile ├── Gemfile.lock ├── README.md ├── Rakefile ├── bin └── parse ├── boolean_term_parser.rb ├── elasticsearch ├── LICENSE.txt ├── NOTICE.txt ├── README.textile ├── bin │ ├── elasticsearch │ ├── elasticsearch-keystore │ ├── elasticsearch-keystore.bat │ ├── elasticsearch-plugin │ ├── elasticsearch-plugin.bat │ ├── elasticsearch-service-mgr.exe │ ├── elasticsearch-service-x64.exe │ ├── elasticsearch-service-x86.exe │ ├── elasticsearch-service.bat │ ├── elasticsearch-systemd-pre-exec │ ├── elasticsearch-translog │ ├── elasticsearch-translog.bat │ ├── elasticsearch.bat │ ├── elasticsearch.in.bat │ └── elasticsearch.in.sh ├── config │ ├── elasticsearch.yml │ ├── jvm.options │ └── log4j2.properties ├── lib │ ├── HdrHistogram-2.1.9.jar │ ├── elasticsearch-5.4.1.jar │ ├── hppc-0.7.1.jar │ ├── jackson-core-2.8.6.jar │ ├── jackson-dataformat-cbor-2.8.6.jar │ ├── jackson-dataformat-smile-2.8.6.jar │ ├── jackson-dataformat-yaml-2.8.6.jar │ ├── java-version-checker-5.4.1.jar │ ├── jna-4.4.0.jar │ ├── joda-time-2.9.5.jar │ ├── jopt-simple-5.0.2.jar │ ├── jts-1.13.jar │ ├── log4j-1.2-api-2.8.2.jar │ ├── log4j-api-2.8.2.jar │ ├── log4j-core-2.8.2.jar │ ├── lucene-analyzers-common-6.5.1.jar │ ├── lucene-backward-codecs-6.5.1.jar │ ├── lucene-core-6.5.1.jar │ ├── lucene-grouping-6.5.1.jar │ ├── lucene-highlighter-6.5.1.jar │ ├── lucene-join-6.5.1.jar │ ├── lucene-memory-6.5.1.jar │ ├── lucene-misc-6.5.1.jar │ ├── lucene-queries-6.5.1.jar │ ├── lucene-queryparser-6.5.1.jar │ ├── lucene-sandbox-6.5.1.jar │ ├── lucene-spatial-6.5.1.jar │ ├── lucene-spatial-extras-6.5.1.jar │ ├── lucene-spatial3d-6.5.1.jar │ ├── lucene-suggest-6.5.1.jar │ ├── securesm-1.1.jar │ ├── snakeyaml-1.15.jar │ ├── spatial4j-0.6.jar │ └── t-digest-3.0.jar └── modules │ ├── aggs-matrix-stats │ ├── aggs-matrix-stats-5.4.1.jar │ └── plugin-descriptor.properties │ ├── ingest-common │ ├── ingest-common-5.4.1.jar │ ├── jcodings-1.0.12.jar │ ├── joni-2.1.6.jar │ └── plugin-descriptor.properties │ ├── lang-expression │ ├── antlr4-runtime-4.5.1-1.jar │ ├── asm-5.0.4.jar │ ├── asm-commons-5.0.4.jar │ ├── asm-tree-5.0.4.jar │ ├── lang-expression-5.4.1.jar │ ├── lucene-expressions-6.5.1.jar │ ├── plugin-descriptor.properties │ └── plugin-security.policy │ ├── lang-groovy │ ├── groovy-2.4.6-indy.jar │ ├── lang-groovy-5.4.1.jar │ ├── plugin-descriptor.properties │ └── plugin-security.policy │ ├── lang-mustache │ ├── compiler-0.9.3.jar │ ├── lang-mustache-5.4.1.jar │ ├── plugin-descriptor.properties │ └── plugin-security.policy │ ├── lang-painless │ ├── antlr4-runtime-4.5.1-1.jar │ ├── asm-debug-all-5.1.jar │ ├── lang-painless-5.4.1.jar │ ├── plugin-descriptor.properties │ └── plugin-security.policy │ ├── percolator │ ├── percolator-5.4.1.jar │ └── plugin-descriptor.properties │ ├── reindex │ ├── commons-codec-1.10.jar │ ├── commons-logging-1.1.3.jar │ ├── httpasyncclient-4.1.2.jar │ ├── httpclient-4.5.2.jar │ ├── httpcore-4.4.5.jar │ ├── httpcore-nio-4.4.5.jar │ ├── plugin-descriptor.properties │ ├── reindex-5.4.1.jar │ └── rest-5.4.1.jar │ ├── transport-netty3 │ ├── netty-3.10.6.Final.jar │ ├── plugin-descriptor.properties │ ├── plugin-security.policy │ └── transport-netty3-5.4.1.jar │ └── transport-netty4 │ ├── netty-buffer-4.1.11.Final.jar │ ├── netty-codec-4.1.11.Final.jar │ ├── netty-codec-http-4.1.11.Final.jar │ ├── netty-common-4.1.11.Final.jar │ ├── netty-handler-4.1.11.Final.jar │ ├── netty-resolver-4.1.11.Final.jar │ ├── netty-transport-4.1.11.Final.jar │ ├── plugin-descriptor.properties │ ├── plugin-security.policy │ └── transport-netty4-5.4.1.jar ├── elasticsearch_helpers.rb ├── heuristic_parser.rb ├── phrase_parser.rb ├── term_parser.rb ├── tests ├── boolean_term_parser_tests.rb ├── boolean_term_transformer_tests.rb ├── heuristic_parser_tests.rb ├── heuristic_transformer_tests.rb ├── integration │ └── search_tests.rb ├── phrase_parser_tests.rb ├── phrase_transformer_tests.rb ├── term_parser_tests.rb └── term_transformer_tests.rb └── tutorial ├── boolean-term-clause.svg ├── build_a_query_parser.md ├── decade.svg ├── heuristic-query.svg ├── layout.html ├── parslet-diagram.svg ├── phrase-query.svg ├── railroad-diagrams ├── boolean_term_parser.js ├── decade.js ├── heuristic_parser.js └── phrase_parser.js ├── safety-vs-power.svg ├── term-query.svg └── term.svg /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | elasticsearch/data 3 | elasticsearch/logs 4 | build 5 | -------------------------------------------------------------------------------- /.java-version: -------------------------------------------------------------------------------- 1 | 1.8 2 | -------------------------------------------------------------------------------- /.ruby-gemset: -------------------------------------------------------------------------------- 1 | query-parser 2 | -------------------------------------------------------------------------------- /.ruby-version: -------------------------------------------------------------------------------- 1 | 2.4.0 2 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | source "https://rubygems.org" 3 | 4 | gem 'parslet' 5 | gem 'minitest' 6 | gem 'awesome_print' 7 | gem 'pry' 8 | gem 'elasticsearch' 9 | gem 'commonmarker' 10 | gem 'commonmarker-rouge', :git => 'git@github.com:look/commonmarker-rouge.git', :ref => '17a8b3555d14' 11 | gem 'rake' 12 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GIT 2 | remote: git@github.com:look/commonmarker-rouge.git 3 | revision: 17a8b3555d143a296dd730c7757b3948d6d07c47 4 | ref: 17a8b3555d14 5 | specs: 6 | commonmarker-rouge (1.0.1) 7 | commonmarker (>= 0.16.0, < 1.0) 8 | rouge (~> 1.10) 9 | 10 | GEM 11 | remote: https://rubygems.org/ 12 | specs: 13 | awesome_print (1.7.0) 14 | coderay (1.1.1) 15 | commonmarker (0.16.0) 16 | ruby-enum (~> 0.5) 17 | elasticsearch (5.0.4) 18 | elasticsearch-api (= 5.0.4) 19 | elasticsearch-transport (= 5.0.4) 20 | elasticsearch-api (5.0.4) 21 | multi_json 22 | elasticsearch-transport (5.0.4) 23 | faraday 24 | multi_json 25 | faraday (0.12.1) 26 | multipart-post (>= 1.2, < 3) 27 | i18n (0.8.1) 28 | method_source (0.8.2) 29 | minitest (5.10.2) 30 | multi_json (1.12.1) 31 | multipart-post (2.0.0) 32 | parslet (1.8.0) 33 | pry (0.10.4) 34 | coderay (~> 1.1.0) 35 | method_source (~> 0.8.1) 36 | slop (~> 3.4) 37 | rake (12.0.0) 38 | rouge (1.11.1) 39 | ruby-enum (0.7.1) 40 | i18n 41 | slop (3.6.0) 42 | 43 | PLATFORMS 44 | ruby 45 | 46 | DEPENDENCIES 47 | awesome_print 48 | commonmarker 49 | commonmarker-rouge! 50 | elasticsearch 51 | minitest 52 | parslet 53 | pry 54 | rake 55 | 56 | BUNDLED WITH 57 | 1.14.6 58 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Build a query parser example code 2 | 3 | This is example code for my tutorial [Build a query parser](http://www.recursion.org/query-parser/). 4 | 5 | ## How the code is organized 6 | 7 | Each query parser is self-contained to make the tutorial easier to follow. This does mean there's a lot of duplication. In order to keep the classes separate, each query parser is contained in its own module. 8 | 9 | The sequence of query parsers is: 10 | 11 | 1. [TermParser](https://github.com/look/query-parser/blob/master/term_parser.rb) 12 | 2. [BooleanTermParser](https://github.com/look/query-parser/blob/master/boolean_term_parser.rb) 13 | 3. [PhraseParser](https://github.com/look/query-parser/blob/master/phrase_parser.rb) 14 | 4. [HeuristicParser](https://github.com/look/query-parser/blob/master/heuristic_parser.rb) 15 | 16 | ## Installing and running 17 | 18 | ### Prerequisites 19 | 20 | You will need Ruby (tested with 2.4) to run the query parsers and Java (tested with 1.8) to run Elasticsearch if you want to try out the parsers for real. I use RVM and jEnv to manage the versions, but you do not have to. 21 | 22 | ### Install dependencies 23 | 24 | ``` 25 | bundle install 26 | ``` 27 | 28 | ### Run unit tests 29 | 30 | ``` 31 | bundle exec rake test 32 | ``` 33 | 34 | ### Run integration tests 35 | 36 | The integration tests require Elasticsearch to be started. 37 | 38 | ``` 39 | elasticsearch/bin/elasticsearch 40 | ``` 41 | 42 | In another terminal: 43 | 44 | ``` 45 | bundle exec rake integration_test 46 | ``` 47 | 48 | ### Query generation console 49 | 50 | The `parse` program allows you to test out the different parser and see the parse tree and Elasticsearch DSL that is generated based on a query string you provide. 51 | 52 | To run it: 53 | 54 | ``` 55 | bundle exec bin/parse 56 | ``` 57 | 58 | The program defaults to the `HeuristicParser` because it is the most featureful. To try one of the others, provide it as a command-line argument: 59 | 60 | ``` 61 | bundle exec bin/parse BooleanTermParser 62 | ``` 63 | 64 | ## License 65 | 66 | The source code in this repository is released into the public domain. 67 | 68 | The tutorial is under copyright and cannot be republished without my permission. 69 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | require 'rake/testtask' 2 | require 'commonmarker' 3 | require 'commonmarker/rouge' 4 | require 'fileutils' 5 | 6 | task :default => :test 7 | 8 | Rake::TestTask.new do |t| 9 | t.test_files = FileList['tests/*_tests.rb'] 10 | # There are some warnings from parslet code that make test output annoying 11 | t.warning = false 12 | end 13 | desc "Run unit tests" 14 | 15 | Rake::TestTask.new(:integration_test) do |t| 16 | t.test_files = FileList['tests/integration/*_tests.rb'] 17 | # There are some warnings from parslet code that make test output annoying 18 | t.warning = false 19 | end 20 | desc "Run integration tests (requires running Elasticsearch server)" 21 | 22 | task :build do 23 | layout = File.read(File.join(__dir__, 'tutorial', 'layout.html')) 24 | tutorial = File.read(File.join(__dir__, 'tutorial', 'build_a_query_parser.md')) 25 | 26 | source_code = Dir[File.join(__dir__, "*.rb")].each_with_object({}) do |filename, obj| 27 | obj[File.basename(filename)] = File.readlines(filename) 28 | end 29 | 30 | svgs = Dir[File.join(__dir__, 'tutorial', '*.svg')].each_with_object({}) do |filename, obj| 31 | obj[File.basename(filename)] = File.read(filename) 32 | end 33 | 34 | # Why yes, I am manipulating markup with regular expressions in a tutorial about writing a parser. 35 | # Why do you ask? 36 | tutorial.gsub!(/^\s*{{svg="([a-z\-]+\.svg)"}}$/) do |s| 37 | filename = $1 38 | "\n\n#{svgs.fetch(filename)}" 39 | end 40 | 41 | tutorial.gsub!(/^\s*{{code="([a-z_]+\.rb):(\d+)-(\d+)"}}$/) do |s| 42 | filename = $1 43 | # Line numbers are 1 indexed 44 | start_line = Integer($2) - 1 45 | end_line = Integer($3) - 1 46 | lines = source_code.fetch(filename).slice(start_line..end_line) 47 | offset = lines.first.index(/[^ ]/) 48 | lines.map! { |l| l[offset, l.length] || "\n" } 49 | %Q(```ruby\n#{lines.join}````) 50 | end 51 | 52 | doc = CommonMarker::Rouge.render_doc(tutorial) 53 | 54 | doc.walk do |node| 55 | if node.type == :header 56 | text = [] 57 | node.each do |subnode| 58 | if subnode.type == :text 59 | text << subnode.string_content 60 | end 61 | end 62 | 63 | # There seems to be only one :text subnode for headers 64 | id = text.map(&:split).flatten.map(&:downcase).map { |word| word.gsub(/[^a-z0-9 ]/, '') }.join('_') 65 | 66 | html = %Q(#{text.join(' ')}) 67 | new_node = ::CommonMarker::Node.new(:html) 68 | new_node.string_content = html 69 | node.insert_before(new_node) 70 | node.delete 71 | end 72 | end 73 | 74 | # TODO: Figure out a better way to create a layout for a markdown document 75 | compiled = layout.gsub('{{CONTENT}}', "#{doc.to_html}#{generated_at_html}") 76 | 77 | FileUtils.mkdir_p('build') 78 | 79 | File.open(File.join(__dir__, 'build', 'index.html'), 'w') do |f| 80 | f.write(compiled) 81 | end 82 | end 83 | 84 | task :deploy => :build do 85 | dest = File.join(__dir__, '..', 'lug', 'static', 'query-parser') 86 | FileUtils.mkdir_p(dest) 87 | FileUtils.cp_r(File.join(__dir__, 'build', '.'), dest) 88 | end 89 | 90 | def generated_at_html 91 | # A little white lie. Only accurate if committed before generation. 92 | git_revision = `git rev-parse HEAD`.chomp[0, 10] 93 | github_revision_url = "https://github.com/look/query-parser/commit/#{git_revision}" 94 | timestamp = Time.now.utc.strftime('%Y-%m-%d %H:%M:%S') 95 | %Q(

Last generated at #{timestamp} from revision #{git_revision}.

) 96 | end 97 | -------------------------------------------------------------------------------- /bin/parse: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env ruby 2 | 3 | require 'ap' 4 | require 'parslet' 5 | require_relative '../elasticsearch_helpers' 6 | require_relative '../heuristic_parser' 7 | require_relative '../term_parser' 8 | require_relative '../boolean_term_parser' 9 | require_relative '../phrase_parser' 10 | 11 | parser_types = ['TermParser', 'BooleanTermParser', 'PhraseParser', 'HeuristicParser'] 12 | parser_type = ARGV[0] || 'HeuristicParser' 13 | 14 | if !parser_types.include?(parser_type) 15 | puts "Parser type must be one of: #{parser_types}" 16 | exit(1) 17 | end 18 | 19 | puts "Welcome to the parser test console. Using #{parser_type}." 20 | puts "Input a query string to see the generated Elasticsearch query DSL." 21 | puts "To exit, use Control-C or Control-D" 22 | 23 | parser = Object.const_get("#{parser_type}::QueryParser").new 24 | transformer = Object.const_get("#{parser_type}::QueryTransformer").new 25 | 26 | trap("SIGINT") do 27 | puts "Exiting..." 28 | exit(0) 29 | end 30 | 31 | while true 32 | puts "Input query string: " 33 | query = $stdin.gets 34 | 35 | if query == nil 36 | puts "Exiting..." 37 | exit(0) 38 | end 39 | 40 | begin 41 | parse_tree = parser.parse(query) 42 | puts "Parse Tree:" 43 | ap parse_tree 44 | puts "Elasticsearch query DSL:" 45 | ap transformer.apply(parse_tree).to_elasticsearch 46 | rescue Parslet::ParseFailed => e 47 | puts e.parse_failure_cause.ascii_tree 48 | end 49 | end 50 | -------------------------------------------------------------------------------- /boolean_term_parser.rb: -------------------------------------------------------------------------------- 1 | require 'parslet' 2 | 3 | module BooleanTermParser 4 | # This query parser adds an optional operator ("+" or "-") to the simple term 5 | # parser. In order to do that, a new "clause" node is added to the parse tree. 6 | class QueryParser < Parslet::Parser 7 | rule(:term) { match('[^\s]').repeat(1).as(:term) } 8 | rule(:operator) { (str('+') | str('-')).as(:operator) } 9 | rule(:clause) { (operator.maybe >> term).as(:clause) } 10 | rule(:space) { match('\s').repeat(1) } 11 | rule(:query) { (clause >> space.maybe).repeat.as(:query) } 12 | root(:query) 13 | end 14 | 15 | class QueryTransformer < Parslet::Transform 16 | rule(:clause => subtree(:clause)) do 17 | Clause.new(clause[:operator]&.to_s, clause[:term].to_s) 18 | end 19 | rule(:query => sequence(:clauses)) { Query.new(clauses) } 20 | end 21 | 22 | class Operator 23 | def self.symbol(str) 24 | case str 25 | when '+' 26 | :must 27 | when '-' 28 | :must_not 29 | when nil 30 | :should 31 | else 32 | raise "Unknown operator: #{str}" 33 | end 34 | end 35 | end 36 | 37 | class Clause 38 | attr_accessor :operator, :term 39 | 40 | def initialize(operator, term) 41 | self.operator = Operator.symbol(operator) 42 | self.term = term 43 | end 44 | end 45 | 46 | class Query 47 | attr_accessor :should_terms, :must_not_terms, :must_terms 48 | 49 | def initialize(clauses) 50 | grouped = clauses.chunk { |c| c.operator }.to_h 51 | self.should_terms = grouped.fetch(:should, []).map(&:term) 52 | self.must_not_terms = grouped.fetch(:must_not, []).map(&:term) 53 | self.must_terms = grouped.fetch(:must, []).map(&:term) 54 | end 55 | 56 | def to_elasticsearch 57 | query = { 58 | :query => { 59 | :bool => { 60 | } 61 | } 62 | } 63 | 64 | if should_terms.any? 65 | query[:query][:bool][:should] = should_terms.map do |term| 66 | match(term) 67 | end 68 | end 69 | 70 | if must_terms.any? 71 | query[:query][:bool][:must] = must_terms.map do |term| 72 | match(term) 73 | end 74 | end 75 | 76 | if must_not_terms.any? 77 | query[:query][:bool][:must_not] = must_not_terms.map do |term| 78 | match(term) 79 | end 80 | end 81 | 82 | query 83 | end 84 | 85 | def match(term) 86 | { 87 | :match => { 88 | :title => { 89 | :query => term 90 | } 91 | } 92 | } 93 | end 94 | end 95 | end 96 | -------------------------------------------------------------------------------- /elasticsearch/LICENSE.txt: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | -------------------------------------------------------------------------------- /elasticsearch/README.textile: -------------------------------------------------------------------------------- 1 | h1. Elasticsearch 2 | 3 | h2. A Distributed RESTful Search Engine 4 | 5 | h3. "https://www.elastic.co/products/elasticsearch":https://www.elastic.co/products/elasticsearch 6 | 7 | Elasticsearch is a distributed RESTful search engine built for the cloud. Features include: 8 | 9 | * Distributed and Highly Available Search Engine. 10 | ** Each index is fully sharded with a configurable number of shards. 11 | ** Each shard can have one or more replicas. 12 | ** Read / Search operations performed on any of the replica shards. 13 | * Multi Tenant with Multi Types. 14 | ** Support for more than one index. 15 | ** Support for more than one type per index. 16 | ** Index level configuration (number of shards, index storage, ...). 17 | * Various set of APIs 18 | ** HTTP RESTful API 19 | ** Native Java API. 20 | ** All APIs perform automatic node operation rerouting. 21 | * Document oriented 22 | ** No need for upfront schema definition. 23 | ** Schema can be defined per type for customization of the indexing process. 24 | * Reliable, Asynchronous Write Behind for long term persistency. 25 | * (Near) Real Time Search. 26 | * Built on top of Lucene 27 | ** Each shard is a fully functional Lucene index 28 | ** All the power of Lucene easily exposed through simple configuration / plugins. 29 | * Per operation consistency 30 | ** Single document level operations are atomic, consistent, isolated and durable. 31 | * Open Source under the Apache License, version 2 ("ALv2") 32 | 33 | h2. Getting Started 34 | 35 | First of all, DON'T PANIC. It will take 5 minutes to get the gist of what Elasticsearch is all about. 36 | 37 | h3. Requirements 38 | 39 | You need to have a recent version of Java installed. See the "Setup":http://www.elastic.co/guide/en/elasticsearch/reference/current/setup.html#jvm-version page for more information. 40 | 41 | h3. Installation 42 | 43 | * "Download":https://www.elastic.co/downloads/elasticsearch and unzip the Elasticsearch official distribution. 44 | * Run @bin/elasticsearch@ on unix, or @bin\elasticsearch.bat@ on windows. 45 | * Run @curl -X GET http://localhost:9200/@. 46 | * Start more servers ... 47 | 48 | h3. Indexing 49 | 50 | Let's try and index some twitter like information. First, let's create a twitter user, and add some tweets (the @twitter@ index will be created automatically): 51 | 52 |
 53 | curl -XPUT 'http://localhost:9200/twitter/user/kimchy?pretty' -H 'Content-Type: application/json' -d '{ "name" : "Shay Banon" }'
 54 | 
 55 | curl -XPUT 'http://localhost:9200/twitter/tweet/1?pretty' -H 'Content-Type: application/json' -d '
 56 | {
 57 |     "user": "kimchy",
 58 |     "post_date": "2009-11-15T13:12:00",
 59 |     "message": "Trying out Elasticsearch, so far so good?"
 60 | }'
 61 | 
 62 | curl -XPUT 'http://localhost:9200/twitter/tweet/2?pretty' -H 'Content-Type: application/json' -d '
 63 | {
 64 |     "user": "kimchy",
 65 |     "post_date": "2009-11-15T14:12:12",
 66 |     "message": "Another tweet, will it be indexed?"
 67 | }'
 68 | 
69 | 70 | Now, let's see if the information was added by GETting it: 71 | 72 |
 73 | curl -XGET 'http://localhost:9200/twitter/user/kimchy?pretty=true'
 74 | curl -XGET 'http://localhost:9200/twitter/tweet/1?pretty=true'
 75 | curl -XGET 'http://localhost:9200/twitter/tweet/2?pretty=true'
 76 | 
77 | 78 | h3. Searching 79 | 80 | Mmm search..., shouldn't it be elastic? 81 | Let's find all the tweets that @kimchy@ posted: 82 | 83 |
 84 | curl -XGET 'http://localhost:9200/twitter/tweet/_search?q=user:kimchy&pretty=true'
 85 | 
86 | 87 | We can also use the JSON query language Elasticsearch provides instead of a query string: 88 | 89 |
 90 | curl -XGET 'http://localhost:9200/twitter/tweet/_search?pretty=true' -H 'Content-Type: application/json' -d '
 91 | {
 92 |     "query" : {
 93 |         "match" : { "user": "kimchy" }
 94 |     }
 95 | }'
 96 | 
97 | 98 | Just for kicks, let's get all the documents stored (we should see the user as well): 99 | 100 |
101 | curl -XGET 'http://localhost:9200/twitter/_search?pretty=true' -H 'Content-Type: application/json' -d '
102 | {
103 |     "query" : {
104 |         "match_all" : {}
105 |     }
106 | }'
107 | 
108 | 109 | We can also do range search (the @postDate@ was automatically identified as date) 110 | 111 |
112 | curl -XGET 'http://localhost:9200/twitter/_search?pretty=true' -H 'Content-Type: application/json' -d '
113 | {
114 |     "query" : {
115 |         "range" : {
116 |             "post_date" : { "from" : "2009-11-15T13:00:00", "to" : "2009-11-15T14:00:00" }
117 |         }
118 |     }
119 | }'
120 | 
121 | 122 | There are many more options to perform search, after all, it's a search product no? All the familiar Lucene queries are available through the JSON query language, or through the query parser. 123 | 124 | h3. Multi Tenant - Indices and Types 125 | 126 | Maan, that twitter index might get big (in this case, index size == valuation). Let's see if we can structure our twitter system a bit differently in order to support such large amounts of data. 127 | 128 | Elasticsearch supports multiple indices, as well as multiple types per index. In the previous example we used an index called @twitter@, with two types, @user@ and @tweet@. 129 | 130 | Another way to define our simple twitter system is to have a different index per user (note, though that each index has an overhead). Here is the indexing curl's in this case: 131 | 132 |
133 | curl -XPUT 'http://localhost:9200/kimchy/info/1?pretty' -H 'Content-Type: application/json' -d '{ "name" : "Shay Banon" }'
134 | 
135 | curl -XPUT 'http://localhost:9200/kimchy/tweet/1?pretty' -H 'Content-Type: application/json' -d '
136 | {
137 |     "user": "kimchy",
138 |     "post_date": "2009-11-15T13:12:00",
139 |     "message": "Trying out Elasticsearch, so far so good?"
140 | }'
141 | 
142 | curl -XPUT 'http://localhost:9200/kimchy/tweet/2?pretty' -H 'Content-Type: application/json' -d '
143 | {
144 |     "user": "kimchy",
145 |     "post_date": "2009-11-15T14:12:12",
146 |     "message": "Another tweet, will it be indexed?"
147 | }'
148 | 
149 | 150 | The above will index information into the @kimchy@ index, with two types, @info@ and @tweet@. Each user will get their own special index. 151 | 152 | Complete control on the index level is allowed. As an example, in the above case, we would want to change from the default 5 shards with 1 replica per index, to only 1 shard with 1 replica per index (== per twitter user). Here is how this can be done (the configuration can be in yaml as well): 153 | 154 |
155 | curl -XPUT http://localhost:9200/another_user?pretty -H 'Content-Type: application/json' -d '
156 | {
157 |     "index" : {
158 |         "number_of_shards" : 1,
159 |         "number_of_replicas" : 1
160 |     }
161 | }'
162 | 
163 | 164 | Search (and similar operations) are multi index aware. This means that we can easily search on more than one 165 | index (twitter user), for example: 166 | 167 |
168 | curl -XGET 'http://localhost:9200/kimchy,another_user/_search?pretty=true' -H 'Content-Type: application/json' -d '
169 | {
170 |     "query" : {
171 |         "match_all" : {}
172 |     }
173 | }'
174 | 
175 | 176 | Or on all the indices: 177 | 178 |
179 | curl -XGET 'http://localhost:9200/_search?pretty=true' -H 'Content-Type: application/json' -d '
180 | {
181 |     "query" : {
182 |         "match_all" : {}
183 |     }
184 | }'
185 | 
186 | 187 | {One liner teaser}: And the cool part about that? You can easily search on multiple twitter users (indices), with different boost levels per user (index), making social search so much simpler (results from my friends rank higher than results from friends of my friends). 188 | 189 | h3. Distributed, Highly Available 190 | 191 | Let's face it, things will fail.... 192 | 193 | Elasticsearch is a highly available and distributed search engine. Each index is broken down into shards, and each shard can have one or more replica. By default, an index is created with 5 shards and 1 replica per shard (5/1). There are many topologies that can be used, including 1/10 (improve search performance), or 20/1 (improve indexing performance, with search executed in a map reduce fashion across shards). 194 | 195 | In order to play with the distributed nature of Elasticsearch, simply bring more nodes up and shut down nodes. The system will continue to serve requests (make sure you use the correct http port) with the latest data indexed. 196 | 197 | h3. Where to go from here? 198 | 199 | We have just covered a very small portion of what Elasticsearch is all about. For more information, please refer to the "elastic.co":http://www.elastic.co/products/elasticsearch website. General questions can be asked on the "Elastic Discourse forum":https://discuss.elastic.co or on IRC on Freenode at "#elasticsearch":https://webchat.freenode.net/#elasticsearch. The Elasticsearch GitHub repository is reserved for bug reports and feature requests only. 200 | 201 | h3. Building from Source 202 | 203 | Elasticsearch uses "Gradle":https://gradle.org for its build system. You'll need to have at least version 3.3 of Gradle installed. 204 | 205 | In order to create a distribution, simply run the @gradle assemble@ command in the cloned directory. 206 | 207 | The distribution for each project will be created under the @build/distributions@ directory in that project. 208 | 209 | See the "TESTING":TESTING.asciidoc file for more information about 210 | running the Elasticsearch test suite. 211 | 212 | h3. Upgrading from Elasticsearch 1.x? 213 | 214 | In order to ensure a smooth upgrade process from earlier versions of 215 | Elasticsearch (1.x), it is required to perform a full cluster restart. Please 216 | see the "setup reference": 217 | https://www.elastic.co/guide/en/elasticsearch/reference/current/setup-upgrade.html 218 | for more details on the upgrade process. 219 | 220 | h1. License 221 | 222 |
223 | This software is licensed under the Apache License, version 2 ("ALv2"), quoted below.
224 | 
225 | Copyright 2009-2016 Elasticsearch 
226 | 
227 | Licensed under the Apache License, Version 2.0 (the "License"); you may not
228 | use this file except in compliance with the License. You may obtain a copy of
229 | the License at
230 | 
231 |     http://www.apache.org/licenses/LICENSE-2.0
232 | 
233 | Unless required by applicable law or agreed to in writing, software
234 | distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
235 | WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
236 | License for the specific language governing permissions and limitations under
237 | the License.
238 | 
239 | -------------------------------------------------------------------------------- /elasticsearch/bin/elasticsearch: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # CONTROLLING STARTUP: 4 | # 5 | # This script relies on few environment variables to determine startup 6 | # behavior, those variables are: 7 | # 8 | # ES_CLASSPATH -- A Java classpath containing everything necessary to run. 9 | # ES_JVM_OPTIONS -- Path to file containing JVM options 10 | # ES_JAVA_OPTS -- External Java Opts on top of the defaults set 11 | # 12 | # Optionally, exact memory values can be set using the `ES_JAVA_OPTS`. 13 | # Note that the Xms and Xmx lines in the JVM options file must be 14 | # commented out. Sample format include "512m", and "10g". 15 | # 16 | # ES_JAVA_OPTS="-Xms8g -Xmx8g" ./bin/elasticsearch 17 | # 18 | # As a convenience, a fragment of shell is sourced in order to set one or 19 | # more of these variables. This so-called `include' can be placed in a 20 | # number of locations and will be searched for in order. The lowest 21 | # priority search path is the same directory as the startup script, and 22 | # since this is the location of the sample in the project tree, it should 23 | # almost work Out Of The Box. 24 | # 25 | # Any serious use-case though will likely require customization of the 26 | # include. For production installations, it is recommended that you copy 27 | # the sample to one of /usr/share/elasticsearch/elasticsearch.in.sh, 28 | # /usr/local/share/elasticsearch/elasticsearch.in.sh, or 29 | # /opt/elasticsearch/elasticsearch.in.sh and make your modifications there. 30 | # 31 | # Another option is to specify the full path to the include file in the 32 | # environment. For example: 33 | # 34 | # $ ES_INCLUDE=/path/to/in.sh elasticsearch -p /var/run/es.pid 35 | # 36 | # Note: This is particularly handy for running multiple instances on a 37 | # single installation, or for quick tests. 38 | # 39 | # If you would rather configure startup entirely from the environment, you 40 | # can disable the include by exporting an empty ES_INCLUDE, or by 41 | # ensuring that no include files exist in the aforementioned search list. 42 | # Be aware that you will be entirely responsible for populating the needed 43 | # environment variables. 44 | 45 | # Check to see if you are trying to run this without building it first. Gradle 46 | # will replace the project.name with _something_. 47 | 48 | if echo 'distribution' | grep project.name > /dev/null ; then 49 | cat >&2 << EOF 50 | Error: You must build the project with Gradle or download a pre-built package 51 | before you can run Elasticsearch. See 'Building from Source' in README.textile 52 | or visit https://www.elastic.co/download to get a pre-built package. 53 | EOF 54 | exit 1 55 | fi 56 | 57 | # TODO: remove for Elasticsearch 6.x 58 | unsupported_environment_variable() { 59 | if test -n "$1"; then 60 | echo "$2=$1: $3" 61 | fi 62 | } 63 | 64 | if test -n "$ES_MIN_MEM" || 65 | test -n "$ES_MAX_MEM" || 66 | test -n "$ES_HEAP_SIZE" || 67 | test -n "$ES_HEAP_NEWSIZE" || 68 | test -n "$ES_DIRECT_SIZE" || 69 | test -n "$ES_USE_IPV4" || 70 | test -n "$ES_GC_OPTS" || 71 | test -n "$ES_GC_LOG_FILE"; then 72 | echo "Error: encountered environment variables that are no longer supported" 73 | echo "Use jvm.options or ES_JAVA_OPTS to configure the JVM" 74 | unsupported_environment_variable "$ES_MIN_MEM" ES_MIN_MEM "set -Xms$ES_MIN_MEM in jvm.options or add \"-Xms$ES_MIN_MEM\" to ES_JAVA_OPTS" 75 | unsupported_environment_variable "$ES_MAX_MEM" ES_MAX_MEM "set -Xmx$ES_MAX_MEM in jvm.options or add \"-Xmx$ES_MAX_MEM\" to ES_JAVA_OPTS" 76 | unsupported_environment_variable "$ES_HEAP_SIZE" ES_HEAP_SIZE "set -Xms$ES_HEAP_SIZE and -Xmx$ES_HEAP_SIZE in jvm.options or add \"-Xms$ES_HEAP_SIZE -Xmx$ES_HEAP_SIZE\" to ES_JAVA_OPTS" 77 | unsupported_environment_variable "$ES_HEAP_NEWSIZE" ES_HEAP_NEWSIZE "set -Xmn$ES_HEAP_NEWSIZE in jvm.options or add \"-Xmn$ES_HEAP_SIZE\" to ES_JAVA_OPTS" 78 | unsupported_environment_variable "$ES_DIRECT_SIZE" ES_DIRECT_SIZE "set -XX:MaxDirectMemorySize=$ES_DIRECT_SIZE in jvm.options or add \"-XX:MaxDirectMemorySize=$ES_DIRECT_SIZE\" to ES_JAVA_OPTS" 79 | unsupported_environment_variable "$ES_USE_IPV4" ES_USE_IPV4 "set -Djava.net.preferIPv4Stack=true in jvm.options or add \"-Djava.net.preferIPv4Stack=true\" to ES_JAVA_OPTS" 80 | unsupported_environment_variable "$ES_GC_OPTS" ES_GC_OPTS "set ${ES_GC_OPTS// / and } in jvm.options or add \"$ES_GC_OPTS\" to ES_JAVA_OPTS" 81 | unsupported_environment_variable "$ES_GC_LOG_FILE" ES_GC_LOG_FILE "set -Xloggc:$ES_GC_LOG_FILE in jvm.options or add \"-Xloggc:$ES_GC_LOG_FILE\" to ES_JAVA_OPTS" 82 | exit 1 83 | fi 84 | # end TODO: remove for Elasticsearch 6.x 85 | 86 | parse_jvm_options() { 87 | if [ -f "$1" ]; then 88 | echo "$(grep "^-" "$1" | tr '\n' ' ')" 89 | fi 90 | } 91 | 92 | CDPATH="" 93 | SCRIPT="$0" 94 | 95 | # SCRIPT may be an arbitrarily deep series of symlinks. Loop until we have the concrete path. 96 | while [ -h "$SCRIPT" ] ; do 97 | ls=`ls -ld "$SCRIPT"` 98 | # Drop everything prior to -> 99 | link=`expr "$ls" : '.*-> \(.*\)$'` 100 | if expr "$link" : '/.*' > /dev/null; then 101 | SCRIPT="$link" 102 | else 103 | SCRIPT=`dirname "$SCRIPT"`/"$link" 104 | fi 105 | done 106 | 107 | # determine elasticsearch home 108 | ES_HOME=`dirname "$SCRIPT"`/.. 109 | 110 | # make ELASTICSEARCH_HOME absolute 111 | ES_HOME=`cd "$ES_HOME"; pwd` 112 | 113 | if [ -z "$ES_JVM_OPTIONS" ]; then 114 | for jvm_options in "$ES_HOME"/config/jvm.options \ 115 | /etc/elasticsearch/jvm.options; do 116 | if [ -r "$jvm_options" ]; then 117 | ES_JVM_OPTIONS=$jvm_options 118 | break 119 | fi 120 | done 121 | fi 122 | 123 | ES_JAVA_OPTS="$(parse_jvm_options "$ES_JVM_OPTIONS") $ES_JAVA_OPTS" 124 | 125 | # If an include wasn't specified in the environment, then search for one... 126 | if [ "x$ES_INCLUDE" = "x" ]; then 127 | # Locations (in order) to use when searching for an include file. 128 | for include in /usr/share/elasticsearch/elasticsearch.in.sh \ 129 | /usr/local/share/elasticsearch/elasticsearch.in.sh \ 130 | /opt/elasticsearch/elasticsearch.in.sh \ 131 | ~/.elasticsearch.in.sh \ 132 | "$ES_HOME/bin/elasticsearch.in.sh" \ 133 | "`dirname "$0"`"/elasticsearch.in.sh; do 134 | if [ -r "$include" ]; then 135 | . "$include" 136 | break 137 | fi 138 | done 139 | # ...otherwise, source the specified include. 140 | elif [ -r "$ES_INCLUDE" ]; then 141 | . "$ES_INCLUDE" 142 | fi 143 | 144 | if [ -x "$JAVA_HOME/bin/java" ]; then 145 | JAVA="$JAVA_HOME/bin/java" 146 | else 147 | JAVA=`which java` 148 | fi 149 | 150 | if [ ! -x "$JAVA" ]; then 151 | echo "Could not find any executable java binary. Please install java in your PATH or set JAVA_HOME" 152 | exit 1 153 | fi 154 | 155 | if [ -z "$ES_CLASSPATH" ]; then 156 | echo "You must set the ES_CLASSPATH var" >&2 157 | exit 1 158 | fi 159 | 160 | # don't let JAVA_TOOL_OPTIONS slip in (e.g. crazy agents in ubuntu) 161 | # works around https://bugs.launchpad.net/ubuntu/+source/jayatana/+bug/1441487 162 | if [ "x$JAVA_TOOL_OPTIONS" != "x" ]; then 163 | echo "Warning: Ignoring JAVA_TOOL_OPTIONS=$JAVA_TOOL_OPTIONS" 164 | echo "Please pass JVM parameters via ES_JAVA_OPTS instead" 165 | unset JAVA_TOOL_OPTIONS 166 | fi 167 | 168 | # JAVA_OPTS is not a built-in JVM mechanism but some people think it is 169 | # so let us warn them that we are not observing the value of $JAVA_OPTS 170 | if [ "x$JAVA_OPTS" != "x" ]; then 171 | echo "Warning: Ignoring JAVA_OPTS=$JAVA_OPTS" 172 | echo "Please pass JVM parameters via ES_JAVA_OPTS instead" 173 | fi 174 | 175 | "$JAVA" -cp "$ES_CLASSPATH" org.elasticsearch.tools.JavaVersionChecker 176 | 177 | if [ $? -ne 0 ]; then 178 | echo "Elasticsearch requires at least Java 8 but your Java version from $JAVA does not meet this requirement" 179 | exit 1 180 | fi 181 | 182 | # full hostname passed through cut for portability on systems that do not support hostname -s 183 | # export on separate line for shells that do not support combining definition and export 184 | HOSTNAME=`hostname | cut -d. -f1` 185 | export HOSTNAME 186 | 187 | # manual parsing to find out, if process should be detached 188 | daemonized=`echo $* | egrep -- '(^-d |-d$| -d |--daemonize$|--daemonize )'` 189 | if [ -z "$daemonized" ] ; then 190 | exec "$JAVA" $ES_JAVA_OPTS -Des.path.home="$ES_HOME" -cp "$ES_CLASSPATH" \ 191 | org.elasticsearch.bootstrap.Elasticsearch "$@" 192 | else 193 | exec "$JAVA" $ES_JAVA_OPTS -Des.path.home="$ES_HOME" -cp "$ES_CLASSPATH" \ 194 | org.elasticsearch.bootstrap.Elasticsearch "$@" <&- & 195 | retval=$? 196 | pid=$! 197 | [ $retval -eq 0 ] || exit $retval 198 | if [ ! -z "$ES_STARTUP_SLEEP_TIME" ]; then 199 | sleep $ES_STARTUP_SLEEP_TIME 200 | fi 201 | if ! ps -p $pid > /dev/null ; then 202 | exit 1 203 | fi 204 | exit 0 205 | fi 206 | 207 | exit $? 208 | -------------------------------------------------------------------------------- /elasticsearch/bin/elasticsearch-keystore: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | CDPATH="" 4 | SCRIPT="$0" 5 | 6 | # SCRIPT may be an arbitrarily deep series of symlinks. Loop until we have the concrete path. 7 | while [ -h "$SCRIPT" ] ; do 8 | ls=`ls -ld "$SCRIPT"` 9 | # Drop everything prior to -> 10 | link=`expr "$ls" : '.*-> \(.*\)$'` 11 | if expr "$link" : '/.*' > /dev/null; then 12 | SCRIPT="$link" 13 | else 14 | SCRIPT=`dirname "$SCRIPT"`/"$link" 15 | fi 16 | done 17 | 18 | # determine elasticsearch home 19 | ES_HOME=`dirname "$SCRIPT"`/.. 20 | 21 | # make ELASTICSEARCH_HOME absolute 22 | ES_HOME=`cd "$ES_HOME"; pwd` 23 | 24 | 25 | # Sets the default values for elasticsearch variables used in this script 26 | if [ -z "$CONF_DIR" ]; then 27 | CONF_DIR="$ES_HOME/config" 28 | fi 29 | 30 | # The default env file is defined at building/packaging time. 31 | # For a distribution package, the value is "". 32 | ES_ENV_FILE="" 33 | 34 | # If an include is specified with the ES_INCLUDE environment variable, use it 35 | if [ -n "$ES_INCLUDE" ]; then 36 | ES_ENV_FILE="$ES_INCLUDE" 37 | fi 38 | 39 | # Source the environment file 40 | if [ -n "$ES_ENV_FILE" ]; then 41 | 42 | # If the ES_ENV_FILE is not found, try to resolve the path 43 | # against the ES_HOME directory 44 | if [ ! -f "$ES_ENV_FILE" ]; then 45 | ES_ENV_FILE="$ELASTIC_HOME/$ES_ENV_FILE" 46 | fi 47 | 48 | . "$ES_ENV_FILE" 49 | if [ $? -ne 0 ]; then 50 | echo "Unable to source environment file: $ES_ENV_FILE" >&2 51 | exit 1 52 | fi 53 | fi 54 | 55 | # don't let JAVA_TOOL_OPTIONS slip in (e.g. crazy agents in ubuntu) 56 | # works around https://bugs.launchpad.net/ubuntu/+source/jayatana/+bug/1441487 57 | if [ "x$JAVA_TOOL_OPTIONS" != "x" ]; then 58 | echo "Warning: Ignoring JAVA_TOOL_OPTIONS=$JAVA_TOOL_OPTIONS" 59 | unset JAVA_TOOL_OPTIONS 60 | fi 61 | 62 | # CONF_FILE setting was removed 63 | if [ ! -z "$CONF_FILE" ]; then 64 | echo "CONF_FILE setting is no longer supported. elasticsearch.yml must be placed in the config directory and cannot be renamed." 65 | exit 1 66 | fi 67 | 68 | if [ -x "$JAVA_HOME/bin/java" ]; then 69 | JAVA=$JAVA_HOME/bin/java 70 | else 71 | JAVA=`which java` 72 | fi 73 | 74 | if [ ! -x "$JAVA" ]; then 75 | echo "Could not find any executable java binary. Please install java in your PATH or set JAVA_HOME" 76 | exit 1 77 | fi 78 | 79 | # full hostname passed through cut for portability on systems that do not support hostname -s 80 | # export on separate line for shells that do not support combining definition and export 81 | HOSTNAME=`hostname | cut -d. -f1` 82 | export HOSTNAME 83 | 84 | declare -a args=("$@") 85 | path_props=(-Des.path.home="$ES_HOME") 86 | 87 | if [ -e "$CONF_DIR" ]; then 88 | path_props=("${path_props[@]}" -Des.path.conf="$CONF_DIR") 89 | fi 90 | 91 | exec "$JAVA" $ES_JAVA_OPTS -Delasticsearch "${path_props[@]}" -cp "$ES_HOME/lib/*" org.elasticsearch.common.settings.KeyStoreCli "${args[@]}" 92 | -------------------------------------------------------------------------------- /elasticsearch/bin/elasticsearch-keystore.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | SETLOCAL enabledelayedexpansion 4 | 5 | IF DEFINED JAVA_HOME ( 6 | set JAVA=%JAVA_HOME%\bin\java.exe 7 | ) ELSE ( 8 | FOR %%I IN (java.exe) DO set JAVA=%%~$PATH:I 9 | ) 10 | IF NOT EXIST "%JAVA%" ( 11 | ECHO Could not find any executable java binary. Please install java in your PATH or set JAVA_HOME 1>&2 12 | EXIT /B 1 13 | ) 14 | 15 | set SCRIPT_DIR=%~dp0 16 | for %%I in ("%SCRIPT_DIR%..") do set ES_HOME=%%~dpfI 17 | 18 | TITLE Elasticsearch Plugin Manager 5.4.1 19 | 20 | SET path_props=-Des.path.home="%ES_HOME%" 21 | IF DEFINED CONF_DIR ( 22 | SET path_props=!path_props! -Des.path.conf="%CONF_DIR%" 23 | ) 24 | 25 | SET args=%* 26 | SET HOSTNAME=%COMPUTERNAME% 27 | 28 | "%JAVA%" %ES_JAVA_OPTS% !path_props! -cp "%ES_HOME%/lib/*;" "org.elasticsearch.common.settings.KeyStoreCli" !args! 29 | 30 | ENDLOCAL 31 | -------------------------------------------------------------------------------- /elasticsearch/bin/elasticsearch-plugin: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | CDPATH="" 4 | SCRIPT="$0" 5 | 6 | # SCRIPT may be an arbitrarily deep series of symlinks. Loop until we have the concrete path. 7 | while [ -h "$SCRIPT" ] ; do 8 | ls=`ls -ld "$SCRIPT"` 9 | # Drop everything prior to -> 10 | link=`expr "$ls" : '.*-> \(.*\)$'` 11 | if expr "$link" : '/.*' > /dev/null; then 12 | SCRIPT="$link" 13 | else 14 | SCRIPT=`dirname "$SCRIPT"`/"$link" 15 | fi 16 | done 17 | 18 | # determine elasticsearch home 19 | ES_HOME=`dirname "$SCRIPT"`/.. 20 | 21 | # make ELASTICSEARCH_HOME absolute 22 | ES_HOME=`cd "$ES_HOME"; pwd` 23 | 24 | 25 | # Sets the default values for elasticsearch variables used in this script 26 | if [ -z "$CONF_DIR" ]; then 27 | CONF_DIR="$ES_HOME/config" 28 | fi 29 | 30 | # The default env file is defined at building/packaging time. 31 | # For a distribution package, the value is "". 32 | ES_ENV_FILE="" 33 | 34 | # If an include is specified with the ES_INCLUDE environment variable, use it 35 | if [ -n "$ES_INCLUDE" ]; then 36 | ES_ENV_FILE="$ES_INCLUDE" 37 | fi 38 | 39 | # Source the environment file 40 | if [ -n "$ES_ENV_FILE" ]; then 41 | 42 | # If the ES_ENV_FILE is not found, try to resolve the path 43 | # against the ES_HOME directory 44 | if [ ! -f "$ES_ENV_FILE" ]; then 45 | ES_ENV_FILE="$ELASTIC_HOME/$ES_ENV_FILE" 46 | fi 47 | 48 | . "$ES_ENV_FILE" 49 | if [ $? -ne 0 ]; then 50 | echo "Unable to source environment file: $ES_ENV_FILE" >&2 51 | exit 1 52 | fi 53 | fi 54 | 55 | # don't let JAVA_TOOL_OPTIONS slip in (e.g. crazy agents in ubuntu) 56 | # works around https://bugs.launchpad.net/ubuntu/+source/jayatana/+bug/1441487 57 | if [ "x$JAVA_TOOL_OPTIONS" != "x" ]; then 58 | echo "Warning: Ignoring JAVA_TOOL_OPTIONS=$JAVA_TOOL_OPTIONS" 59 | unset JAVA_TOOL_OPTIONS 60 | fi 61 | 62 | # CONF_FILE setting was removed 63 | if [ ! -z "$CONF_FILE" ]; then 64 | echo "CONF_FILE setting is no longer supported. elasticsearch.yml must be placed in the config directory and cannot be renamed." 65 | exit 1 66 | fi 67 | 68 | if [ -x "$JAVA_HOME/bin/java" ]; then 69 | JAVA=$JAVA_HOME/bin/java 70 | else 71 | JAVA=`which java` 72 | fi 73 | 74 | if [ ! -x "$JAVA" ]; then 75 | echo "Could not find any executable java binary. Please install java in your PATH or set JAVA_HOME" 76 | exit 1 77 | fi 78 | 79 | # full hostname passed through cut for portability on systems that do not support hostname -s 80 | # export on separate line for shells that do not support combining definition and export 81 | HOSTNAME=`hostname | cut -d. -f1` 82 | export HOSTNAME 83 | 84 | declare -a args=("$@") 85 | path_props=(-Des.path.home="$ES_HOME") 86 | 87 | if [ -e "$CONF_DIR" ]; then 88 | path_props=("${path_props[@]}" -Des.path.conf="$CONF_DIR") 89 | fi 90 | 91 | exec "$JAVA" $ES_JAVA_OPTS -Delasticsearch "${path_props[@]}" -cp "$ES_HOME/lib/*" org.elasticsearch.plugins.PluginCli "${args[@]}" 92 | -------------------------------------------------------------------------------- /elasticsearch/bin/elasticsearch-plugin.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | SETLOCAL enabledelayedexpansion 4 | 5 | IF DEFINED JAVA_HOME ( 6 | set JAVA="%JAVA_HOME%\bin\java.exe" 7 | ) ELSE ( 8 | FOR %%I IN (java.exe) DO set JAVA=%%~$PATH:I 9 | ) 10 | IF NOT EXIST %JAVA% ( 11 | ECHO Could not find any executable java binary. Please install java in your PATH or set JAVA_HOME 1>&2 12 | EXIT /B 1 13 | ) 14 | 15 | set SCRIPT_DIR=%~dp0 16 | for %%I in ("%SCRIPT_DIR%..") do set ES_HOME=%%~dpfI 17 | 18 | TITLE Elasticsearch Plugin Manager 5.4.1 19 | 20 | SET path_props=-Des.path.home="%ES_HOME%" 21 | IF DEFINED CONF_DIR ( 22 | SET path_props=!path_props! -Des.path.conf="%CONF_DIR%" 23 | ) 24 | 25 | SET args=%* 26 | SET HOSTNAME=%COMPUTERNAME% 27 | 28 | %JAVA% %ES_JAVA_OPTS% !path_props! -cp "%ES_HOME%/lib/*;" "org.elasticsearch.plugins.PluginCli" !args! 29 | 30 | ENDLOCAL 31 | -------------------------------------------------------------------------------- /elasticsearch/bin/elasticsearch-service-mgr.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/bin/elasticsearch-service-mgr.exe -------------------------------------------------------------------------------- /elasticsearch/bin/elasticsearch-service-x64.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/bin/elasticsearch-service-x64.exe -------------------------------------------------------------------------------- /elasticsearch/bin/elasticsearch-service-x86.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/bin/elasticsearch-service-x86.exe -------------------------------------------------------------------------------- /elasticsearch/bin/elasticsearch-service.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | SETLOCAL enabledelayedexpansion 3 | 4 | TITLE Elasticsearch Service 5.4.1 5 | 6 | rem TODO: remove for Elasticsearch 6.x 7 | set bad_env_var=0 8 | if not "%ES_MIN_MEM%" == "" set bad_env_var=1 9 | if not "%ES_MAX_MEM%" == "" set bad_env_var=1 10 | if not "%ES_HEAP_SIZE%" == "" set bad_env_var=1 11 | if not "%ES_HEAP_NEWSIZE%" == "" set bad_env_var=1 12 | if not "%ES_DIRECT_SIZE%" == "" set bad_env_var=1 13 | if not "%ES_USE_IPV4%" == "" set bad_env_var=1 14 | if not "%ES_GC_OPTS%" == "" set bad_env_var=1 15 | if not "%ES_GC_LOG_FILE%" == "" set bad_env_var=1 16 | if %bad_env_var% == 1 ( 17 | echo Error: encountered environment variables that are no longer supported 18 | echo Use jvm.options or ES_JAVA_OPTS to configure the JVM 19 | if not "%ES_MIN_MEM%" == "" echo ES_MIN_MEM=%ES_MIN_MEM%: set -Xms%ES_MIN_MEM% in jvm.options or add "-Xms%ES_MIN_MEM%" to ES_JAVA_OPTS 20 | if not "%ES_MAX_MEM%" == "" echo ES_MAX_MEM=%ES_MAX_MEM%: set -Xms%ES_MAX_MEM% in jvm.options or add "-Xmx%ES_MAX_MEM%" to ES_JAVA_OPTS 21 | if not "%ES_HEAP_SIZE%" == "" echo ES_HEAP_SIZE=%ES_HEAP_SIZE%: set -Xms%ES_HEAP_SIZE% and -Xmx%ES_HEAP_SIZE% in jvm.options or add "-Xms%ES_HEAP_SIZE% -Xmx%ES_HEAP_SIZE%" to ES_JAVA_OPTS 22 | if not "%ES_HEAP_NEWSIZE%" == "" echo ES_HEAP_NEWSIZE=%ES_HEAP_NEWSIZE%: set -Xmn%ES_HEAP_NEWSIZE% in jvm.options or add "-Xmn%ES_HEAP_SIZE%" to ES_JAVA_OPTS 23 | if not "%ES_DIRECT_SIZE%" == "" echo ES_DIRECT_SIZE=%ES_DIRECT_SIZE%: set -XX:MaxDirectMemorySize=%ES_DIRECT_SIZE% in jvm.options or add "-XX:MaxDirectMemorySize=%ES_DIRECT_SIZE%" to ES_JAVA_OPTS 24 | if not "%ES_USE_IPV4%" == "" echo ES_USE_IPV4=%ES_USE_IPV4%: set -Djava.net.preferIPv4Stack=true in jvm.options or add "-Djava.net.preferIPv4Stack=true" to ES_JAVA_OPTS 25 | if not "%ES_GC_OPTS%" == "" echo ES_GC_OPTS=%ES_GC_OPTS%: set %ES_GC_OPTS: = and % in jvm.options or add "%ES_GC_OPTS%" to ES_JAVA_OPTS 26 | if not "%ES_GC_LOG_FILE%" == "" echo ES_GC_LOG_FILE=%ES_GC_LOG_FILE%: set -Xloggc:%ES_GC_LOG_FILE% in jvm.options or add "-Xloggc:%ES_GC_LOG_FILE%" to ES_JAVA_OPTS" 27 | exit /b 1 28 | ) 29 | rem end TODO: remove for Elasticsearch 6.x 30 | 31 | IF DEFINED JAVA_HOME ( 32 | SET JAVA="%JAVA_HOME%\bin\java.exe" 33 | ) ELSE ( 34 | FOR %%I IN (java.exe) DO set JAVA=%%~$PATH:I 35 | ) 36 | IF NOT EXIST %JAVA% ( 37 | ECHO Could not find any executable java binary. Please install java in your PATH or set JAVA_HOME 1>&2 38 | EXIT /B 1 39 | ) 40 | IF DEFINED JAVA_HOME GOTO :cont 41 | 42 | IF NOT %JAVA:~-13% == "\bin\java.exe" ( 43 | FOR /f "tokens=2 delims=[]" %%I IN ('dir %JAVA%') DO @set JAVA=%%I 44 | ) 45 | IF %JAVA:~-13% == "\bin\java.exe" ( 46 | SET JAVA_HOME=%JAVA:~0,-13% 47 | ) 48 | 49 | :cont 50 | if not "%CONF_FILE%" == "" goto conffileset 51 | 52 | set SCRIPT_DIR=%~dp0 53 | for %%I in ("%SCRIPT_DIR%..") do set ES_HOME=%%~dpfI 54 | 55 | %JAVA% -Xmx50M -version > nul 2>&1 56 | 57 | if errorlevel 1 ( 58 | echo Warning: Could not start JVM to detect version, defaulting to x86: 59 | goto x86 60 | ) 61 | 62 | %JAVA% -Xmx50M -version 2>&1 | "%windir%\System32\find" "64-Bit" >nul: 63 | 64 | if errorlevel 1 goto x86 65 | set EXECUTABLE=%ES_HOME%\bin\elasticsearch-service-x64.exe 66 | set SERVICE_ID=elasticsearch-service-x64 67 | set ARCH=64-bit 68 | goto checkExe 69 | 70 | :x86 71 | set EXECUTABLE=%ES_HOME%\bin\elasticsearch-service-x86.exe 72 | set SERVICE_ID=elasticsearch-service-x86 73 | set ARCH=32-bit 74 | 75 | :checkExe 76 | if EXIST "%EXECUTABLE%" goto okExe 77 | echo elasticsearch-service-(x86|x64).exe was not found... 78 | 79 | :okExe 80 | set ES_VERSION=5.4.1 81 | 82 | if "%LOG_DIR%" == "" set LOG_DIR=%ES_HOME%\logs 83 | 84 | if "x%1x" == "xx" goto displayUsage 85 | set SERVICE_CMD=%1 86 | shift 87 | if "x%1x" == "xx" goto checkServiceCmd 88 | set SERVICE_ID=%1 89 | 90 | :checkServiceCmd 91 | 92 | if "%LOG_OPTS%" == "" set LOG_OPTS=--LogPath "%LOG_DIR%" --LogPrefix "%SERVICE_ID%" --StdError auto --StdOutput auto 93 | 94 | if /i %SERVICE_CMD% == install goto doInstall 95 | if /i %SERVICE_CMD% == remove goto doRemove 96 | if /i %SERVICE_CMD% == start goto doStart 97 | if /i %SERVICE_CMD% == stop goto doStop 98 | if /i %SERVICE_CMD% == manager goto doManagment 99 | echo Unknown option "%SERVICE_CMD%" 100 | 101 | :displayUsage 102 | echo. 103 | echo Usage: elasticsearch-service.bat install^|remove^|start^|stop^|manager [SERVICE_ID] 104 | goto:eof 105 | 106 | :doStart 107 | "%EXECUTABLE%" //ES//%SERVICE_ID% %LOG_OPTS% 108 | if not errorlevel 1 goto started 109 | echo Failed starting '%SERVICE_ID%' service 110 | goto:eof 111 | :started 112 | echo The service '%SERVICE_ID%' has been started 113 | goto:eof 114 | 115 | :doStop 116 | "%EXECUTABLE%" //SS//%SERVICE_ID% %LOG_OPTS% 117 | if not errorlevel 1 goto stopped 118 | echo Failed stopping '%SERVICE_ID%' service 119 | goto:eof 120 | :stopped 121 | echo The service '%SERVICE_ID%' has been stopped 122 | goto:eof 123 | 124 | :doManagment 125 | set EXECUTABLE_MGR=%ES_HOME%\bin\elasticsearch-service-mgr.exe 126 | "%EXECUTABLE_MGR%" //ES//%SERVICE_ID% 127 | if not errorlevel 1 goto managed 128 | echo Failed starting service manager for '%SERVICE_ID%' 129 | goto:eof 130 | :managed 131 | echo Successfully started service manager for '%SERVICE_ID%'. 132 | goto:eof 133 | 134 | :doRemove 135 | rem Remove the service 136 | "%EXECUTABLE%" //DS//%SERVICE_ID% %LOG_OPTS% 137 | if not errorlevel 1 goto removed 138 | echo Failed removing '%SERVICE_ID%' service 139 | goto:eof 140 | :removed 141 | echo The service '%SERVICE_ID%' has been removed 142 | goto:eof 143 | 144 | :doInstall 145 | echo Installing service : "%SERVICE_ID%" 146 | echo Using JAVA_HOME (%ARCH%): "%JAVA_HOME%" 147 | 148 | rem Check JVM server dll first 149 | if exist "%JAVA_HOME%\jre\bin\server\jvm.dll" ( 150 | set JVM_DLL=\jre\bin\server\jvm.dll 151 | goto foundJVM 152 | ) 153 | 154 | rem Check 'server' JRE (JRE installed on Windows Server) 155 | if exist "%JAVA_HOME%\bin\server\jvm.dll" ( 156 | set JVM_DLL=\bin\server\jvm.dll 157 | goto foundJVM 158 | ) 159 | 160 | rem Fallback to 'client' JRE 161 | if exist "%JAVA_HOME%\bin\client\jvm.dll" ( 162 | set JVM_DLL=\bin\client\jvm.dll 163 | echo Warning: JAVA_HOME points to a JRE and not JDK installation; a client (not a server^) JVM will be used... 164 | ) else ( 165 | echo JAVA_HOME points to an invalid Java installation (no jvm.dll found in "%JAVA_HOME%"^). Exiting... 166 | goto:eof 167 | ) 168 | 169 | :foundJVM 170 | if "%ES_JVM_OPTIONS%" == "" ( 171 | set ES_JVM_OPTIONS=%ES_HOME%\config\jvm.options 172 | ) 173 | 174 | if not "%ES_JAVA_OPTS%" == "" set ES_JAVA_OPTS=%ES_JAVA_OPTS: =;% 175 | 176 | @setlocal 177 | for /F "usebackq delims=" %%a in (`findstr /b \- "%ES_JVM_OPTIONS%" ^| findstr /b /v "\-server \-client"`) do set JVM_OPTIONS=!JVM_OPTIONS!%%a; 178 | @endlocal & set ES_JAVA_OPTS=%JVM_OPTIONS%%ES_JAVA_OPTS% 179 | 180 | if "%ES_JAVA_OPTS:~-1%"==";" set ES_JAVA_OPTS=%ES_JAVA_OPTS:~0,-1% 181 | 182 | @setlocal EnableDelayedExpansion 183 | for %%a in ("%ES_JAVA_OPTS:;=","%") do ( 184 | set var=%%a 185 | if "!var:~1,4!" == "-Xms" ( 186 | if not "!JVM_MS!" == "" ( 187 | echo duplicate min heap size settings found 188 | goto:eof 189 | ) 190 | set XMS=!var:~5,-1! 191 | call:convertxm !XMS! JVM_MS 192 | ) 193 | if "!var:~1,16!" == "-XX:MinHeapSize=" ( 194 | if not "!JVM_MS!" == "" ( 195 | echo duplicate min heap size settings found 196 | goto:eof 197 | ) 198 | set XMS=!var:~17,-1! 199 | call:convertxm !XMS! JVM_MS 200 | ) 201 | if "!var:~1,4!" == "-Xmx" ( 202 | if not "!JVM_MX!" == "" ( 203 | echo duplicate max heap size settings found 204 | goto:eof 205 | ) 206 | set XMX=!var:~5,-1! 207 | call:convertxm !XMX! JVM_MX 208 | ) 209 | if "!var:~1,16!" == "-XX:MaxHeapSize=" ( 210 | if not "!JVM_MX!" == "" ( 211 | echo duplicate max heap size settings found 212 | goto:eof 213 | ) 214 | set XMX=!var:~17,-1! 215 | call:convertxm !XMX! JVM_MX 216 | ) 217 | if "!var:~1,4!" == "-Xss" ( 218 | if not "!JVM_SS!" == "" ( 219 | echo duplicate thread stack size settings found 220 | exit 1 221 | ) 222 | set XSS=!var:~5,-1! 223 | call:convertxk !XSS! JVM_SS 224 | ) 225 | if "!var:~1,20!" == "-XX:ThreadStackSize=" ( 226 | if not "!JVM_SS!" == "" ( 227 | echo duplicate thread stack size settings found 228 | goto:eof 229 | ) 230 | set XSS=!var:~21,-1! 231 | call:convertxk !XSS! JVM_SS 232 | ) 233 | ) 234 | @endlocal & set JVM_MS=%JVM_MS% & set JVM_MX=%JVM_MX% & set JVM_SS=%JVM_SS% 235 | 236 | if "%JVM_MS%" == "" ( 237 | echo minimum heap size not set; configure using -Xms via %ES_JVM_OPTIONS% or ES_JAVA_OPTS 238 | goto:eof 239 | ) 240 | if "%JVM_MX%" == "" ( 241 | echo maximum heap size not set; configure using -Xmx via %ES_JVM_OPTIONS% or ES_JAVA_OPTS 242 | goto:eof 243 | ) 244 | if "%JVM_SS%" == "" ( 245 | echo thread stack size not set; configure using -Xss via %ES_JVM_OPTIONS% or ES_JAVA_OPTS 246 | goto:eof 247 | ) 248 | 249 | CALL "%ES_HOME%\bin\elasticsearch.in.bat" 250 | if "%DATA_DIR%" == "" set DATA_DIR=%ES_HOME%\data 251 | 252 | if "%CONF_DIR%" == "" set CONF_DIR=%ES_HOME%\config 253 | 254 | set ES_PARAMS=-Delasticsearch;-Des.path.home="%ES_HOME%";-Des.default.path.logs="%LOG_DIR%";-Des.default.path.data="%DATA_DIR%";-Des.default.path.conf="%CONF_DIR%" 255 | 256 | if "%ES_START_TYPE%" == "" set ES_START_TYPE=manual 257 | if "%ES_STOP_TIMEOUT%" == "" set ES_STOP_TIMEOUT=0 258 | 259 | if "%SERVICE_DISPLAY_NAME%" == "" set SERVICE_DISPLAY_NAME=Elasticsearch %ES_VERSION% (%SERVICE_ID%) 260 | if "%SERVICE_DESCRIPTION%" == "" set SERVICE_DESCRIPTION=Elasticsearch %ES_VERSION% Windows Service - https://elastic.co 261 | 262 | if not "%SERVICE_USERNAME%" == "" ( 263 | if not "%SERVICE_PASSWORD%" == "" ( 264 | set SERVICE_PARAMS=%SERVICE_PARAMS% --ServiceUser "%SERVICE_USERNAME%" --ServicePassword "%SERVICE_PASSWORD%" 265 | ) 266 | ) 267 | 268 | "%EXECUTABLE%" //IS//%SERVICE_ID% --Startup %ES_START_TYPE% --StopTimeout %ES_STOP_TIMEOUT% --StartClass org.elasticsearch.bootstrap.Elasticsearch --StopClass org.elasticsearch.bootstrap.Elasticsearch --StartMethod main --StopMethod close --Classpath "%ES_CLASSPATH%" --JvmMs %JVM_MS% --JvmMx %JVM_MX% --JvmSs %JVM_SS% --JvmOptions %ES_JAVA_OPTS% ++JvmOptions %ES_PARAMS% %LOG_OPTS% --PidFile "%SERVICE_ID%.pid" --DisplayName "%SERVICE_DISPLAY_NAME%" --Description "%SERVICE_DESCRIPTION%" --Jvm "%%JAVA_HOME%%%JVM_DLL%" --StartMode jvm --StopMode jvm --StartPath "%ES_HOME%" %SERVICE_PARAMS% 269 | 270 | if not errorlevel 1 goto installed 271 | echo Failed installing '%SERVICE_ID%' service 272 | goto:eof 273 | 274 | :installed 275 | echo The service '%SERVICE_ID%' has been installed. 276 | goto:eof 277 | 278 | :err 279 | echo JAVA_HOME environment variable must be set! 280 | pause 281 | goto:eof 282 | 283 | rem --- 284 | rem Function for converting Xm[s|x] values into MB which Commons Daemon accepts 285 | rem --- 286 | :convertxm 287 | set value=%~1 288 | rem extract last char (unit) 289 | set unit=%value:~-1% 290 | rem assume the unit is specified 291 | set conv=%value:~0,-1% 292 | 293 | if "%unit%" == "k" goto kilo 294 | if "%unit%" == "K" goto kilo 295 | if "%unit%" == "m" goto mega 296 | if "%unit%" == "M" goto mega 297 | if "%unit%" == "g" goto giga 298 | if "%unit%" == "G" goto giga 299 | 300 | rem no unit found, must be bytes; consider the whole value 301 | set conv=%value% 302 | rem convert to KB 303 | set /a conv=%conv% / 1024 304 | :kilo 305 | rem convert to MB 306 | set /a conv=%conv% / 1024 307 | goto mega 308 | :giga 309 | rem convert to MB 310 | set /a conv=%conv% * 1024 311 | :mega 312 | set "%~2=%conv%" 313 | goto:eof 314 | 315 | :convertxk 316 | set value=%~1 317 | rem extract last char (unit) 318 | set unit=%value:~-1% 319 | rem assume the unit is specified 320 | set conv=%value:~0,-1% 321 | 322 | if "%unit%" == "k" goto kilo 323 | if "%unit%" == "K" goto kilo 324 | if "%unit%" == "m" goto mega 325 | if "%unit%" == "M" goto mega 326 | if "%unit%" == "g" goto giga 327 | if "%unit%" == "G" goto giga 328 | 329 | rem no unit found, must be bytes; consider the whole value 330 | set conv=%value% 331 | rem convert to KB 332 | set /a conv=%conv% / 1024 333 | goto kilo 334 | :mega 335 | rem convert to KB 336 | set /a conv=%conv% * 1024 337 | goto kilo 338 | :giga 339 | rem convert to KB 340 | set /a conv=%conv% * 1024 * 1024 341 | :kilo 342 | set "%~2=%conv%" 343 | goto:eof 344 | 345 | :conffileset 346 | echo CONF_FILE setting is no longer supported. elasticsearch.yml must be placed in the config directory and cannot be renamed. 347 | goto:eof 348 | 349 | ENDLOCAL 350 | -------------------------------------------------------------------------------- /elasticsearch/bin/elasticsearch-systemd-pre-exec: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # CONF_FILE setting was removed 4 | if [ ! -z "$CONF_FILE" ]; then 5 | echo "CONF_FILE setting is no longer supported. elasticsearch.yml must be placed in the config directory and cannot be renamed." 6 | exit 1 7 | fi 8 | -------------------------------------------------------------------------------- /elasticsearch/bin/elasticsearch-translog: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | CDPATH="" 4 | SCRIPT="$0" 5 | 6 | # SCRIPT may be an arbitrarily deep series of symlinks. Loop until we have the concrete path. 7 | while [ -h "$SCRIPT" ] ; do 8 | ls=`ls -ld "$SCRIPT"` 9 | # Drop everything prior to -> 10 | link=`expr "$ls" : '.*-> \(.*\)$'` 11 | if expr "$link" : '/.*' > /dev/null; then 12 | SCRIPT="$link" 13 | else 14 | SCRIPT=`dirname "$SCRIPT"`/"$link" 15 | fi 16 | done 17 | 18 | # determine elasticsearch home 19 | ES_HOME=`dirname "$SCRIPT"`/.. 20 | 21 | # make ELASTICSEARCH_HOME absolute 22 | ES_HOME=`cd "$ES_HOME"; pwd` 23 | 24 | 25 | # Sets the default values for elasticsearch variables used in this script 26 | if [ -z "$CONF_DIR" ]; then 27 | CONF_DIR="$ES_HOME/config" 28 | fi 29 | 30 | # The default env file is defined at building/packaging time. 31 | # For a distribution package, the value is "". 32 | ES_ENV_FILE="" 33 | 34 | # If an include is specified with the ES_INCLUDE environment variable, use it 35 | if [ -n "$ES_INCLUDE" ]; then 36 | ES_ENV_FILE="$ES_INCLUDE" 37 | fi 38 | 39 | # Source the environment file 40 | if [ -n "$ES_ENV_FILE" ]; then 41 | 42 | # If the ES_ENV_FILE is not found, try to resolve the path 43 | # against the ES_HOME directory 44 | if [ ! -f "$ES_ENV_FILE" ]; then 45 | ES_ENV_FILE="$ELASTIC_HOME/$ES_ENV_FILE" 46 | fi 47 | 48 | . "$ES_ENV_FILE" 49 | if [ $? -ne 0 ]; then 50 | echo "Unable to source environment file: $ES_ENV_FILE" >&2 51 | exit 1 52 | fi 53 | fi 54 | 55 | # don't let JAVA_TOOL_OPTIONS slip in (e.g. crazy agents in ubuntu) 56 | # works around https://bugs.launchpad.net/ubuntu/+source/jayatana/+bug/1441487 57 | if [ "x$JAVA_TOOL_OPTIONS" != "x" ]; then 58 | echo "Warning: Ignoring JAVA_TOOL_OPTIONS=$JAVA_TOOL_OPTIONS" 59 | unset JAVA_TOOL_OPTIONS 60 | fi 61 | 62 | # CONF_FILE setting was removed 63 | if [ ! -z "$CONF_FILE" ]; then 64 | echo "CONF_FILE setting is no longer supported. elasticsearch.yml must be placed in the config directory and cannot be renamed." 65 | exit 1 66 | fi 67 | 68 | if [ -x "$JAVA_HOME/bin/java" ]; then 69 | JAVA=$JAVA_HOME/bin/java 70 | else 71 | JAVA=`which java` 72 | fi 73 | 74 | if [ ! -x "$JAVA" ]; then 75 | echo "Could not find any executable java binary. Please install java in your PATH or set JAVA_HOME" 76 | exit 1 77 | fi 78 | 79 | # full hostname passed through cut for portability on systems that do not support hostname -s 80 | # export on separate line for shells that do not support combining definition and export 81 | HOSTNAME=`hostname | cut -d. -f1` 82 | export HOSTNAME 83 | 84 | declare -a args=("$@") 85 | 86 | if [ -e "$CONF_DIR" ]; then 87 | args=("${args[@]}" -Edefault.path.conf="$CONF_DIR") 88 | fi 89 | 90 | exec "$JAVA" $ES_JAVA_OPTS -Delasticsearch -Des.path.home="$ES_HOME" -cp "$ES_HOME/lib/*" org.elasticsearch.index.translog.TranslogToolCli "${args[@]}" 91 | -------------------------------------------------------------------------------- /elasticsearch/bin/elasticsearch-translog.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | SETLOCAL enabledelayedexpansion 4 | 5 | IF DEFINED JAVA_HOME ( 6 | set JAVA=%JAVA_HOME%\bin\java.exe 7 | ) ELSE ( 8 | FOR %%I IN (java.exe) DO set JAVA=%%~$PATH:I 9 | ) 10 | IF NOT EXIST "%JAVA%" ( 11 | ECHO Could not find any executable java binary. Please install java in your PATH or set JAVA_HOME 1>&2 12 | EXIT /B 1 13 | ) 14 | 15 | set SCRIPT_DIR=%~dp0 16 | for %%I in ("%SCRIPT_DIR%..") do set ES_HOME=%%~dpfI 17 | 18 | TITLE Elasticsearch Plugin Manager 5.4.1 19 | 20 | SET properties= 21 | SET args= 22 | 23 | :loop 24 | SET "current=%~1" 25 | SHIFT 26 | IF "x!current!" == "x" GOTO breakloop 27 | 28 | IF "!current:~0,2%!" == "-D" ( 29 | ECHO "!current!" | FINDSTR /C:"=">nul && ( 30 | :: current matches -D*=* 31 | IF "x!properties!" NEQ "x" ( 32 | SET properties=!properties! "!current!" 33 | ) ELSE ( 34 | SET properties="!current!" 35 | ) 36 | ) || ( 37 | :: current matches -D* 38 | IF "x!properties!" NEQ "x" ( 39 | SET properties=!properties! "!current!=%~1" 40 | ) ELSE ( 41 | SET properties="!current!=%~1" 42 | ) 43 | SHIFT 44 | ) 45 | ) ELSE ( 46 | :: current matches * 47 | IF "x!args!" NEQ "x" ( 48 | SET args=!args! "!current!" 49 | ) ELSE ( 50 | SET args="!current!" 51 | ) 52 | ) 53 | 54 | GOTO loop 55 | :breakloop 56 | 57 | SET HOSTNAME=%COMPUTERNAME% 58 | 59 | "%JAVA%" %ES_JAVA_OPTS% -Des.path.home="%ES_HOME%" !properties! -cp "%ES_HOME%/lib/*;" "org.elasticsearch.index.translog.TranslogToolCli" !args! 60 | 61 | ENDLOCAL 62 | -------------------------------------------------------------------------------- /elasticsearch/bin/elasticsearch.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | SETLOCAL enabledelayedexpansion 4 | TITLE Elasticsearch 5.4.1 5 | 6 | SET params='%*' 7 | 8 | rem TODO: remove for Elasticsearch 6.x 9 | set bad_env_var=0 10 | if not "%ES_MIN_MEM%" == "" set bad_env_var=1 11 | if not "%ES_MAX_MEM%" == "" set bad_env_var=1 12 | if not "%ES_HEAP_SIZE%" == "" set bad_env_var=1 13 | if not "%ES_HEAP_NEWSIZE%" == "" set bad_env_var=1 14 | if not "%ES_DIRECT_SIZE%" == "" set bad_env_var=1 15 | if not "%ES_USE_IPV4%" == "" set bad_env_var=1 16 | if not "%ES_GC_OPTS%" == "" set bad_env_var=1 17 | if not "%ES_GC_LOG_FILE%" == "" set bad_env_var=1 18 | if %bad_env_var% == 1 ( 19 | echo Error: encountered environment variables that are no longer supported 20 | echo Use jvm.options or ES_JAVA_OPTS to configure the JVM 21 | if not "%ES_MIN_MEM%" == "" echo ES_MIN_MEM=%ES_MIN_MEM%: set -Xms%ES_MIN_MEM% in jvm.options or add "-Xms%ES_MIN_MEM%" to ES_JAVA_OPTS 22 | if not "%ES_MAX_MEM%" == "" echo ES_MAX_MEM=%ES_MAX_MEM%: set -Xmx%ES_MAX_MEM% in jvm.options or add "-Xmx%ES_MAX_MEM%" to ES_JAVA_OPTS 23 | if not "%ES_HEAP_SIZE%" == "" echo ES_HEAP_SIZE=%ES_HEAP_SIZE%: set -Xms%ES_HEAP_SIZE% and -Xmx%ES_HEAP_SIZE% in jvm.options or add "-Xms%ES_HEAP_SIZE% -Xmx%ES_HEAP_SIZE%" to ES_JAVA_OPTS 24 | if not "%ES_HEAP_NEWSIZE%" == "" echo ES_HEAP_NEWSIZE=%ES_HEAP_NEWSIZE%: set -Xmn%ES_HEAP_NEWSIZE% in jvm.options or add "-Xmn%ES_HEAP_SIZE%" to ES_JAVA_OPTS 25 | if not "%ES_DIRECT_SIZE%" == "" echo ES_DIRECT_SIZE=%ES_DIRECT_SIZE%: set -XX:MaxDirectMemorySize=%ES_DIRECT_SIZE% in jvm.options or add "-XX:MaxDirectMemorySize=%ES_DIRECT_SIZE%" to ES_JAVA_OPTS 26 | if not "%ES_USE_IPV4%" == "" echo ES_USE_IPV4=%ES_USE_IPV4%: set -Djava.net.preferIPv4Stack=true in jvm.options or add "-Djava.net.preferIPv4Stack=true" to ES_JAVA_OPTS 27 | if not "%ES_GC_OPTS%" == "" echo ES_GC_OPTS=%ES_GC_OPTS%: set %ES_GC_OPTS: = and % in jvm.options or add "%ES_GC_OPTS%" to ES_JAVA_OPTS 28 | if not "%ES_GC_LOG_FILE%" == "" echo ES_GC_LOG_FILE=%ES_GC_LOG_FILE%: set -Xloggc:%ES_GC_LOG_FILE% in jvm.options or add "-Xloggc:%ES_GC_LOG_FILE%" to ES_JAVA_OPTS" 29 | exit /b 1 30 | ) 31 | rem end TODO: remove for Elasticsearch 6.x 32 | 33 | :loop 34 | FOR /F "usebackq tokens=1* delims= " %%A IN (!params!) DO ( 35 | SET current=%%A 36 | SET params='%%B' 37 | SET silent=N 38 | 39 | IF "!current!" == "-s" ( 40 | SET silent=Y 41 | ) 42 | IF "!current!" == "--silent" ( 43 | SET silent=Y 44 | ) 45 | 46 | IF "!silent!" == "Y" ( 47 | SET nopauseonerror=Y 48 | ) ELSE ( 49 | IF "x!newparams!" NEQ "x" ( 50 | SET newparams=!newparams! !current! 51 | ) ELSE ( 52 | SET newparams=!current! 53 | ) 54 | ) 55 | 56 | IF "x!params!" NEQ "x" ( 57 | GOTO loop 58 | ) 59 | ) 60 | 61 | SET HOSTNAME=%COMPUTERNAME% 62 | 63 | if "%ES_JVM_OPTIONS%" == "" ( 64 | rem '0' is the batch file, '~dp' appends the drive and path 65 | set "ES_JVM_OPTIONS=%~dp0\..\config\jvm.options" 66 | ) 67 | 68 | @setlocal 69 | rem extract the options from the JVM options file %ES_JVM_OPTIONS% 70 | rem such options are the lines beginning with '-', thus "findstr /b" 71 | for /F "usebackq delims=" %%a in (`findstr /b \- "%ES_JVM_OPTIONS%"`) do set JVM_OPTIONS=!JVM_OPTIONS! %%a 72 | @endlocal & set ES_JAVA_OPTS=%JVM_OPTIONS% %ES_JAVA_OPTS% 73 | 74 | CALL "%~dp0elasticsearch.in.bat" 75 | IF ERRORLEVEL 1 ( 76 | IF NOT DEFINED nopauseonerror ( 77 | PAUSE 78 | ) 79 | EXIT /B %ERRORLEVEL% 80 | ) 81 | 82 | %JAVA% %ES_JAVA_OPTS% %ES_PARAMS% -cp "%ES_CLASSPATH%" "org.elasticsearch.bootstrap.Elasticsearch" !newparams! 83 | 84 | ENDLOCAL 85 | -------------------------------------------------------------------------------- /elasticsearch/bin/elasticsearch.in.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | IF DEFINED JAVA_HOME ( 4 | set JAVA="%JAVA_HOME%\bin\java.exe" 5 | ) ELSE ( 6 | FOR %%I IN (java.exe) DO set JAVA=%%~$PATH:I 7 | ) 8 | IF NOT EXIST %JAVA% ( 9 | ECHO Could not find any executable java binary. Please install java in your PATH or set JAVA_HOME 1>&2 10 | EXIT /B 1 11 | ) 12 | 13 | set SCRIPT_DIR=%~dp0 14 | for %%I in ("%SCRIPT_DIR%..") do set ES_HOME=%%~dpfI 15 | 16 | REM check in case a user was using this mechanism 17 | if "%ES_CLASSPATH%" == "" ( 18 | set ES_CLASSPATH=!ES_HOME!/lib/* 19 | ) else ( 20 | ECHO Error: Don't modify the classpath with ES_CLASSPATH, Best is to add 1>&2 21 | ECHO additional elements via the plugin mechanism, or if code must really be 1>&2 22 | ECHO added to the main classpath, add jars to lib\, unsupported 1>&2 23 | EXIT /B 1 24 | ) 25 | 26 | %JAVA% -cp "%ES_CLASSPATH%" "org.elasticsearch.tools.JavaVersionChecker" 27 | 28 | IF ERRORLEVEL 1 ( 29 | ECHO Elasticsearch requires at least Java 8 but your Java version from %JAVA% does not meet this requirement 30 | EXIT /B 1 31 | ) 32 | 33 | set ES_PARAMS=-Delasticsearch -Des.path.home="%ES_HOME%" 34 | -------------------------------------------------------------------------------- /elasticsearch/bin/elasticsearch.in.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # check in case a user was using this mechanism 4 | if [ "x$ES_CLASSPATH" != "x" ]; then 5 | cat >&2 << EOF 6 | Error: Don't modify the classpath with ES_CLASSPATH. Best is to add 7 | additional elements via the plugin mechanism, or if code must really be 8 | added to the main classpath, add jars to lib/ (unsupported). 9 | EOF 10 | exit 1 11 | fi 12 | 13 | ES_CLASSPATH="$ES_HOME/lib/*" 14 | -------------------------------------------------------------------------------- /elasticsearch/config/elasticsearch.yml: -------------------------------------------------------------------------------- 1 | # ======================== Elasticsearch Configuration ========================= 2 | # 3 | # NOTE: Elasticsearch comes with reasonable defaults for most settings. 4 | # Before you set out to tweak and tune the configuration, make sure you 5 | # understand what are you trying to accomplish and the consequences. 6 | # 7 | # The primary way of configuring a node is via this file. This template lists 8 | # the most important settings you may want to configure for a production cluster. 9 | # 10 | # Please consult the documentation for further information on configuration options: 11 | # https://www.elastic.co/guide/en/elasticsearch/reference/index.html 12 | # 13 | # ---------------------------------- Cluster ----------------------------------- 14 | # 15 | # Use a descriptive name for your cluster: 16 | # 17 | #cluster.name: my-application 18 | # 19 | # ------------------------------------ Node ------------------------------------ 20 | # 21 | # Use a descriptive name for the node: 22 | # 23 | #node.name: node-1 24 | # 25 | # Add custom attributes to the node: 26 | # 27 | #node.attr.rack: r1 28 | # 29 | # ----------------------------------- Paths ------------------------------------ 30 | # 31 | # Path to directory where to store the data (separate multiple locations by comma): 32 | # 33 | #path.data: /path/to/data 34 | # 35 | # Path to log files: 36 | # 37 | #path.logs: /path/to/logs 38 | # 39 | # ----------------------------------- Memory ----------------------------------- 40 | # 41 | # Lock the memory on startup: 42 | # 43 | #bootstrap.memory_lock: true 44 | # 45 | # Make sure that the heap size is set to about half the memory available 46 | # on the system and that the owner of the process is allowed to use this 47 | # limit. 48 | # 49 | # Elasticsearch performs poorly when the system is swapping the memory. 50 | # 51 | # ---------------------------------- Network ----------------------------------- 52 | # 53 | # Set the bind address to a specific IP (IPv4 or IPv6): 54 | # 55 | #network.host: 192.168.0.1 56 | # 57 | # Set a custom port for HTTP: 58 | # 59 | #http.port: 9200 60 | # 61 | # For more information, consult the network module documentation. 62 | # 63 | # --------------------------------- Discovery ---------------------------------- 64 | # 65 | # Pass an initial list of hosts to perform discovery when new node is started: 66 | # The default list of hosts is ["127.0.0.1", "[::1]"] 67 | # 68 | #discovery.zen.ping.unicast.hosts: ["host1", "host2"] 69 | # 70 | # Prevent the "split brain" by configuring the majority of nodes (total number of master-eligible nodes / 2 + 1): 71 | # 72 | #discovery.zen.minimum_master_nodes: 3 73 | # 74 | # For more information, consult the zen discovery module documentation. 75 | # 76 | # ---------------------------------- Gateway ----------------------------------- 77 | # 78 | # Block initial recovery after a full cluster restart until N nodes are started: 79 | # 80 | #gateway.recover_after_nodes: 3 81 | # 82 | # For more information, consult the gateway module documentation. 83 | # 84 | # ---------------------------------- Various ----------------------------------- 85 | # 86 | # Require explicit names when deleting indices: 87 | # 88 | #action.destructive_requires_name: true 89 | -------------------------------------------------------------------------------- /elasticsearch/config/jvm.options: -------------------------------------------------------------------------------- 1 | ## JVM configuration 2 | 3 | ################################################################ 4 | ## IMPORTANT: JVM heap size 5 | ################################################################ 6 | ## 7 | ## You should always set the min and max JVM heap 8 | ## size to the same value. For example, to set 9 | ## the heap to 4 GB, set: 10 | ## 11 | ## -Xms4g 12 | ## -Xmx4g 13 | ## 14 | ## See https://www.elastic.co/guide/en/elasticsearch/reference/current/heap-size.html 15 | ## for more information 16 | ## 17 | ################################################################ 18 | 19 | # Xms represents the initial size of total heap space 20 | # Xmx represents the maximum size of total heap space 21 | 22 | -Xms2g 23 | -Xmx2g 24 | 25 | ################################################################ 26 | ## Expert settings 27 | ################################################################ 28 | ## 29 | ## All settings below this section are considered 30 | ## expert settings. Don't tamper with them unless 31 | ## you understand what you are doing 32 | ## 33 | ################################################################ 34 | 35 | ## GC configuration 36 | -XX:+UseConcMarkSweepGC 37 | -XX:CMSInitiatingOccupancyFraction=75 38 | -XX:+UseCMSInitiatingOccupancyOnly 39 | 40 | ## optimizations 41 | 42 | # disable calls to System#gc 43 | -XX:+DisableExplicitGC 44 | 45 | # pre-touch memory pages used by the JVM during initialization 46 | -XX:+AlwaysPreTouch 47 | 48 | ## basic 49 | 50 | # force the server VM (remove on 32-bit client JVMs) 51 | -server 52 | 53 | # explicitly set the stack size (reduce to 320k on 32-bit client JVMs) 54 | -Xss1m 55 | 56 | # set to headless, just in case 57 | -Djava.awt.headless=true 58 | 59 | # ensure UTF-8 encoding by default (e.g. filenames) 60 | -Dfile.encoding=UTF-8 61 | 62 | # use our provided JNA always versus the system one 63 | -Djna.nosys=true 64 | 65 | # use old-style file permissions on JDK9 66 | -Djdk.io.permissionsUseCanonicalPath=true 67 | 68 | # flags to configure Netty 69 | -Dio.netty.noUnsafe=true 70 | -Dio.netty.noKeySetOptimization=true 71 | -Dio.netty.recycler.maxCapacityPerThread=0 72 | 73 | # log4j 2 74 | -Dlog4j.shutdownHookEnabled=false 75 | -Dlog4j2.disable.jmx=true 76 | -Dlog4j.skipJansi=true 77 | 78 | ## heap dumps 79 | 80 | # generate a heap dump when an allocation from the Java heap fails 81 | # heap dumps are created in the working directory of the JVM 82 | -XX:+HeapDumpOnOutOfMemoryError 83 | 84 | # specify an alternative path for heap dumps 85 | # ensure the directory exists and has sufficient space 86 | #-XX:HeapDumpPath=${heap.dump.path} 87 | 88 | ## GC logging 89 | 90 | #-XX:+PrintGCDetails 91 | #-XX:+PrintGCTimeStamps 92 | #-XX:+PrintGCDateStamps 93 | #-XX:+PrintClassHistogram 94 | #-XX:+PrintTenuringDistribution 95 | #-XX:+PrintGCApplicationStoppedTime 96 | 97 | # log GC status to a file with time stamps 98 | # ensure the directory exists 99 | #-Xloggc:${loggc} 100 | 101 | # By default, the GC log file will not rotate. 102 | # By uncommenting the lines below, the GC log file 103 | # will be rotated every 128MB at most 32 times. 104 | #-XX:+UseGCLogFileRotation 105 | #-XX:NumberOfGCLogFiles=32 106 | #-XX:GCLogFileSize=128M 107 | 108 | # Elasticsearch 5.0.0 will throw an exception on unquoted field names in JSON. 109 | # If documents were already indexed with unquoted fields in a previous version 110 | # of Elasticsearch, some operations may throw errors. 111 | # 112 | # WARNING: This option will be removed in Elasticsearch 6.0.0 and is provided 113 | # only for migration purposes. 114 | #-Delasticsearch.json.allow_unquoted_field_names=true 115 | -------------------------------------------------------------------------------- /elasticsearch/config/log4j2.properties: -------------------------------------------------------------------------------- 1 | status = error 2 | 3 | # log action execution errors for easier debugging 4 | logger.action.name = org.elasticsearch.action 5 | logger.action.level = debug 6 | 7 | appender.console.type = Console 8 | appender.console.name = console 9 | appender.console.layout.type = PatternLayout 10 | appender.console.layout.pattern = [%d{ISO8601}][%-5p][%-25c{1.}] %marker%m%n 11 | 12 | appender.rolling.type = RollingFile 13 | appender.rolling.name = rolling 14 | appender.rolling.fileName = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}.log 15 | appender.rolling.layout.type = PatternLayout 16 | appender.rolling.layout.pattern = [%d{ISO8601}][%-5p][%-25c{1.}] %marker%.-10000m%n 17 | appender.rolling.filePattern = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}-%d{yyyy-MM-dd}.log 18 | appender.rolling.policies.type = Policies 19 | appender.rolling.policies.time.type = TimeBasedTriggeringPolicy 20 | appender.rolling.policies.time.interval = 1 21 | appender.rolling.policies.time.modulate = true 22 | 23 | rootLogger.level = info 24 | rootLogger.appenderRef.console.ref = console 25 | rootLogger.appenderRef.rolling.ref = rolling 26 | 27 | appender.deprecation_rolling.type = RollingFile 28 | appender.deprecation_rolling.name = deprecation_rolling 29 | appender.deprecation_rolling.fileName = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}_deprecation.log 30 | appender.deprecation_rolling.layout.type = PatternLayout 31 | appender.deprecation_rolling.layout.pattern = [%d{ISO8601}][%-5p][%-25c{1.}] %marker%.-10000m%n 32 | appender.deprecation_rolling.filePattern = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}_deprecation-%i.log.gz 33 | appender.deprecation_rolling.policies.type = Policies 34 | appender.deprecation_rolling.policies.size.type = SizeBasedTriggeringPolicy 35 | appender.deprecation_rolling.policies.size.size = 1GB 36 | appender.deprecation_rolling.strategy.type = DefaultRolloverStrategy 37 | appender.deprecation_rolling.strategy.max = 4 38 | 39 | logger.deprecation.name = org.elasticsearch.deprecation 40 | logger.deprecation.level = warn 41 | logger.deprecation.appenderRef.deprecation_rolling.ref = deprecation_rolling 42 | logger.deprecation.additivity = false 43 | 44 | appender.index_search_slowlog_rolling.type = RollingFile 45 | appender.index_search_slowlog_rolling.name = index_search_slowlog_rolling 46 | appender.index_search_slowlog_rolling.fileName = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}_index_search_slowlog.log 47 | appender.index_search_slowlog_rolling.layout.type = PatternLayout 48 | appender.index_search_slowlog_rolling.layout.pattern = [%d{ISO8601}][%-5p][%-25c] %marker%.-10000m%n 49 | appender.index_search_slowlog_rolling.filePattern = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}_index_search_slowlog-%d{yyyy-MM-dd}.log 50 | appender.index_search_slowlog_rolling.policies.type = Policies 51 | appender.index_search_slowlog_rolling.policies.time.type = TimeBasedTriggeringPolicy 52 | appender.index_search_slowlog_rolling.policies.time.interval = 1 53 | appender.index_search_slowlog_rolling.policies.time.modulate = true 54 | 55 | logger.index_search_slowlog_rolling.name = index.search.slowlog 56 | logger.index_search_slowlog_rolling.level = trace 57 | logger.index_search_slowlog_rolling.appenderRef.index_search_slowlog_rolling.ref = index_search_slowlog_rolling 58 | logger.index_search_slowlog_rolling.additivity = false 59 | 60 | appender.index_indexing_slowlog_rolling.type = RollingFile 61 | appender.index_indexing_slowlog_rolling.name = index_indexing_slowlog_rolling 62 | appender.index_indexing_slowlog_rolling.fileName = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}_index_indexing_slowlog.log 63 | appender.index_indexing_slowlog_rolling.layout.type = PatternLayout 64 | appender.index_indexing_slowlog_rolling.layout.pattern = [%d{ISO8601}][%-5p][%-25c] %marker%.-10000m%n 65 | appender.index_indexing_slowlog_rolling.filePattern = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}_index_indexing_slowlog-%d{yyyy-MM-dd}.log 66 | appender.index_indexing_slowlog_rolling.policies.type = Policies 67 | appender.index_indexing_slowlog_rolling.policies.time.type = TimeBasedTriggeringPolicy 68 | appender.index_indexing_slowlog_rolling.policies.time.interval = 1 69 | appender.index_indexing_slowlog_rolling.policies.time.modulate = true 70 | 71 | logger.index_indexing_slowlog.name = index.indexing.slowlog.index 72 | logger.index_indexing_slowlog.level = trace 73 | logger.index_indexing_slowlog.appenderRef.index_indexing_slowlog_rolling.ref = index_indexing_slowlog_rolling 74 | logger.index_indexing_slowlog.additivity = false 75 | -------------------------------------------------------------------------------- /elasticsearch/lib/HdrHistogram-2.1.9.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/lib/HdrHistogram-2.1.9.jar -------------------------------------------------------------------------------- /elasticsearch/lib/elasticsearch-5.4.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/lib/elasticsearch-5.4.1.jar -------------------------------------------------------------------------------- /elasticsearch/lib/hppc-0.7.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/lib/hppc-0.7.1.jar -------------------------------------------------------------------------------- /elasticsearch/lib/jackson-core-2.8.6.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/lib/jackson-core-2.8.6.jar -------------------------------------------------------------------------------- /elasticsearch/lib/jackson-dataformat-cbor-2.8.6.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/lib/jackson-dataformat-cbor-2.8.6.jar -------------------------------------------------------------------------------- /elasticsearch/lib/jackson-dataformat-smile-2.8.6.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/lib/jackson-dataformat-smile-2.8.6.jar -------------------------------------------------------------------------------- /elasticsearch/lib/jackson-dataformat-yaml-2.8.6.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/lib/jackson-dataformat-yaml-2.8.6.jar -------------------------------------------------------------------------------- /elasticsearch/lib/java-version-checker-5.4.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/lib/java-version-checker-5.4.1.jar -------------------------------------------------------------------------------- /elasticsearch/lib/jna-4.4.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/lib/jna-4.4.0.jar -------------------------------------------------------------------------------- /elasticsearch/lib/joda-time-2.9.5.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/lib/joda-time-2.9.5.jar -------------------------------------------------------------------------------- /elasticsearch/lib/jopt-simple-5.0.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/lib/jopt-simple-5.0.2.jar -------------------------------------------------------------------------------- /elasticsearch/lib/jts-1.13.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/lib/jts-1.13.jar -------------------------------------------------------------------------------- /elasticsearch/lib/log4j-1.2-api-2.8.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/lib/log4j-1.2-api-2.8.2.jar -------------------------------------------------------------------------------- /elasticsearch/lib/log4j-api-2.8.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/lib/log4j-api-2.8.2.jar -------------------------------------------------------------------------------- /elasticsearch/lib/log4j-core-2.8.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/lib/log4j-core-2.8.2.jar -------------------------------------------------------------------------------- /elasticsearch/lib/lucene-analyzers-common-6.5.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/lib/lucene-analyzers-common-6.5.1.jar -------------------------------------------------------------------------------- /elasticsearch/lib/lucene-backward-codecs-6.5.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/lib/lucene-backward-codecs-6.5.1.jar -------------------------------------------------------------------------------- /elasticsearch/lib/lucene-core-6.5.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/lib/lucene-core-6.5.1.jar -------------------------------------------------------------------------------- /elasticsearch/lib/lucene-grouping-6.5.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/lib/lucene-grouping-6.5.1.jar -------------------------------------------------------------------------------- /elasticsearch/lib/lucene-highlighter-6.5.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/lib/lucene-highlighter-6.5.1.jar -------------------------------------------------------------------------------- /elasticsearch/lib/lucene-join-6.5.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/lib/lucene-join-6.5.1.jar -------------------------------------------------------------------------------- /elasticsearch/lib/lucene-memory-6.5.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/lib/lucene-memory-6.5.1.jar -------------------------------------------------------------------------------- /elasticsearch/lib/lucene-misc-6.5.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/lib/lucene-misc-6.5.1.jar -------------------------------------------------------------------------------- /elasticsearch/lib/lucene-queries-6.5.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/lib/lucene-queries-6.5.1.jar -------------------------------------------------------------------------------- /elasticsearch/lib/lucene-queryparser-6.5.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/lib/lucene-queryparser-6.5.1.jar -------------------------------------------------------------------------------- /elasticsearch/lib/lucene-sandbox-6.5.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/lib/lucene-sandbox-6.5.1.jar -------------------------------------------------------------------------------- /elasticsearch/lib/lucene-spatial-6.5.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/lib/lucene-spatial-6.5.1.jar -------------------------------------------------------------------------------- /elasticsearch/lib/lucene-spatial-extras-6.5.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/lib/lucene-spatial-extras-6.5.1.jar -------------------------------------------------------------------------------- /elasticsearch/lib/lucene-spatial3d-6.5.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/lib/lucene-spatial3d-6.5.1.jar -------------------------------------------------------------------------------- /elasticsearch/lib/lucene-suggest-6.5.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/lib/lucene-suggest-6.5.1.jar -------------------------------------------------------------------------------- /elasticsearch/lib/securesm-1.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/lib/securesm-1.1.jar -------------------------------------------------------------------------------- /elasticsearch/lib/snakeyaml-1.15.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/lib/snakeyaml-1.15.jar -------------------------------------------------------------------------------- /elasticsearch/lib/spatial4j-0.6.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/lib/spatial4j-0.6.jar -------------------------------------------------------------------------------- /elasticsearch/lib/t-digest-3.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/lib/t-digest-3.0.jar -------------------------------------------------------------------------------- /elasticsearch/modules/aggs-matrix-stats/aggs-matrix-stats-5.4.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/modules/aggs-matrix-stats/aggs-matrix-stats-5.4.1.jar -------------------------------------------------------------------------------- /elasticsearch/modules/aggs-matrix-stats/plugin-descriptor.properties: -------------------------------------------------------------------------------- 1 | # Elasticsearch plugin descriptor file 2 | # This file must exist as 'plugin-descriptor.properties' in a folder named `elasticsearch` 3 | # inside all plugins. 4 | # 5 | ### example plugin for "foo" 6 | # 7 | # foo.zip <-- zip file for the plugin, with this structure: 8 | #|____elasticsearch/ 9 | #| |____ .jar <-- classes, resources, dependencies 10 | #| |____ .jar <-- any number of jars 11 | #| |____ plugin-descriptor.properties <-- example contents below: 12 | # 13 | # classname=foo.bar.BazPlugin 14 | # description=My cool plugin 15 | # version=2.0 16 | # elasticsearch.version=2.0 17 | # java.version=1.7 18 | # 19 | ### mandatory elements for all plugins: 20 | # 21 | # 'description': simple summary of the plugin 22 | description=Adds aggregations whose input are a list of numeric fields and output includes a matrix. 23 | # 24 | # 'version': plugin's version 25 | version=5.4.1 26 | # 27 | # 'name': the plugin name 28 | name=aggs-matrix-stats 29 | # 30 | # 'classname': the name of the class to load, fully-qualified. 31 | classname=org.elasticsearch.search.aggregations.matrix.MatrixAggregationPlugin 32 | # 33 | # 'java.version': version of java the code is built against 34 | # use the system property java.specification.version 35 | # version string must be a sequence of nonnegative decimal integers 36 | # separated by "."'s and may have leading zeros 37 | java.version=1.8 38 | # 39 | # 'elasticsearch.version': version of elasticsearch compiled against 40 | elasticsearch.version=5.4.1 41 | ### optional elements for plugins: 42 | # 43 | # 'has.native.controller': whether or not the plugin has a native controller 44 | has.native.controller=false 45 | -------------------------------------------------------------------------------- /elasticsearch/modules/ingest-common/ingest-common-5.4.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/modules/ingest-common/ingest-common-5.4.1.jar -------------------------------------------------------------------------------- /elasticsearch/modules/ingest-common/jcodings-1.0.12.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/modules/ingest-common/jcodings-1.0.12.jar -------------------------------------------------------------------------------- /elasticsearch/modules/ingest-common/joni-2.1.6.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/modules/ingest-common/joni-2.1.6.jar -------------------------------------------------------------------------------- /elasticsearch/modules/ingest-common/plugin-descriptor.properties: -------------------------------------------------------------------------------- 1 | # Elasticsearch plugin descriptor file 2 | # This file must exist as 'plugin-descriptor.properties' in a folder named `elasticsearch` 3 | # inside all plugins. 4 | # 5 | ### example plugin for "foo" 6 | # 7 | # foo.zip <-- zip file for the plugin, with this structure: 8 | #|____elasticsearch/ 9 | #| |____ .jar <-- classes, resources, dependencies 10 | #| |____ .jar <-- any number of jars 11 | #| |____ plugin-descriptor.properties <-- example contents below: 12 | # 13 | # classname=foo.bar.BazPlugin 14 | # description=My cool plugin 15 | # version=2.0 16 | # elasticsearch.version=2.0 17 | # java.version=1.7 18 | # 19 | ### mandatory elements for all plugins: 20 | # 21 | # 'description': simple summary of the plugin 22 | description=Module for ingest processors that do not require additional security permissions or have large dependencies and resources 23 | # 24 | # 'version': plugin's version 25 | version=5.4.1 26 | # 27 | # 'name': the plugin name 28 | name=ingest-common 29 | # 30 | # 'classname': the name of the class to load, fully-qualified. 31 | classname=org.elasticsearch.ingest.common.IngestCommonPlugin 32 | # 33 | # 'java.version': version of java the code is built against 34 | # use the system property java.specification.version 35 | # version string must be a sequence of nonnegative decimal integers 36 | # separated by "."'s and may have leading zeros 37 | java.version=1.8 38 | # 39 | # 'elasticsearch.version': version of elasticsearch compiled against 40 | elasticsearch.version=5.4.1 41 | ### optional elements for plugins: 42 | # 43 | # 'has.native.controller': whether or not the plugin has a native controller 44 | has.native.controller=false 45 | -------------------------------------------------------------------------------- /elasticsearch/modules/lang-expression/antlr4-runtime-4.5.1-1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/modules/lang-expression/antlr4-runtime-4.5.1-1.jar -------------------------------------------------------------------------------- /elasticsearch/modules/lang-expression/asm-5.0.4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/modules/lang-expression/asm-5.0.4.jar -------------------------------------------------------------------------------- /elasticsearch/modules/lang-expression/asm-commons-5.0.4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/modules/lang-expression/asm-commons-5.0.4.jar -------------------------------------------------------------------------------- /elasticsearch/modules/lang-expression/asm-tree-5.0.4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/modules/lang-expression/asm-tree-5.0.4.jar -------------------------------------------------------------------------------- /elasticsearch/modules/lang-expression/lang-expression-5.4.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/modules/lang-expression/lang-expression-5.4.1.jar -------------------------------------------------------------------------------- /elasticsearch/modules/lang-expression/lucene-expressions-6.5.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/modules/lang-expression/lucene-expressions-6.5.1.jar -------------------------------------------------------------------------------- /elasticsearch/modules/lang-expression/plugin-descriptor.properties: -------------------------------------------------------------------------------- 1 | # Elasticsearch plugin descriptor file 2 | # This file must exist as 'plugin-descriptor.properties' in a folder named `elasticsearch` 3 | # inside all plugins. 4 | # 5 | ### example plugin for "foo" 6 | # 7 | # foo.zip <-- zip file for the plugin, with this structure: 8 | #|____elasticsearch/ 9 | #| |____ .jar <-- classes, resources, dependencies 10 | #| |____ .jar <-- any number of jars 11 | #| |____ plugin-descriptor.properties <-- example contents below: 12 | # 13 | # classname=foo.bar.BazPlugin 14 | # description=My cool plugin 15 | # version=2.0 16 | # elasticsearch.version=2.0 17 | # java.version=1.7 18 | # 19 | ### mandatory elements for all plugins: 20 | # 21 | # 'description': simple summary of the plugin 22 | description=Lucene expressions integration for Elasticsearch 23 | # 24 | # 'version': plugin's version 25 | version=5.4.1 26 | # 27 | # 'name': the plugin name 28 | name=lang-expression 29 | # 30 | # 'classname': the name of the class to load, fully-qualified. 31 | classname=org.elasticsearch.script.expression.ExpressionPlugin 32 | # 33 | # 'java.version': version of java the code is built against 34 | # use the system property java.specification.version 35 | # version string must be a sequence of nonnegative decimal integers 36 | # separated by "."'s and may have leading zeros 37 | java.version=1.8 38 | # 39 | # 'elasticsearch.version': version of elasticsearch compiled against 40 | elasticsearch.version=5.4.1 41 | ### optional elements for plugins: 42 | # 43 | # 'has.native.controller': whether or not the plugin has a native controller 44 | has.native.controller=false 45 | -------------------------------------------------------------------------------- /elasticsearch/modules/lang-expression/plugin-security.policy: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to Elasticsearch under one or more contributor 3 | * license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright 5 | * ownership. Elasticsearch licenses this file to you under 6 | * the Apache License, Version 2.0 (the "License"); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | grant { 21 | // needed to generate runtime classes 22 | permission java.lang.RuntimePermission "createClassLoader"; 23 | 24 | // expression runtime 25 | permission org.elasticsearch.script.ClassPermission "java.lang.String"; 26 | permission org.elasticsearch.script.ClassPermission "org.apache.lucene.expressions.Expression"; 27 | permission org.elasticsearch.script.ClassPermission "org.apache.lucene.search.DoubleValues"; 28 | // available functions 29 | permission org.elasticsearch.script.ClassPermission "java.lang.Math"; 30 | permission org.elasticsearch.script.ClassPermission "org.apache.lucene.util.MathUtil"; 31 | permission org.elasticsearch.script.ClassPermission "org.apache.lucene.util.SloppyMath"; 32 | }; 33 | -------------------------------------------------------------------------------- /elasticsearch/modules/lang-groovy/groovy-2.4.6-indy.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/modules/lang-groovy/groovy-2.4.6-indy.jar -------------------------------------------------------------------------------- /elasticsearch/modules/lang-groovy/lang-groovy-5.4.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/modules/lang-groovy/lang-groovy-5.4.1.jar -------------------------------------------------------------------------------- /elasticsearch/modules/lang-groovy/plugin-descriptor.properties: -------------------------------------------------------------------------------- 1 | # Elasticsearch plugin descriptor file 2 | # This file must exist as 'plugin-descriptor.properties' in a folder named `elasticsearch` 3 | # inside all plugins. 4 | # 5 | ### example plugin for "foo" 6 | # 7 | # foo.zip <-- zip file for the plugin, with this structure: 8 | #|____elasticsearch/ 9 | #| |____ .jar <-- classes, resources, dependencies 10 | #| |____ .jar <-- any number of jars 11 | #| |____ plugin-descriptor.properties <-- example contents below: 12 | # 13 | # classname=foo.bar.BazPlugin 14 | # description=My cool plugin 15 | # version=2.0 16 | # elasticsearch.version=2.0 17 | # java.version=1.7 18 | # 19 | ### mandatory elements for all plugins: 20 | # 21 | # 'description': simple summary of the plugin 22 | description=Groovy scripting integration for Elasticsearch 23 | # 24 | # 'version': plugin's version 25 | version=5.4.1 26 | # 27 | # 'name': the plugin name 28 | name=lang-groovy 29 | # 30 | # 'classname': the name of the class to load, fully-qualified. 31 | classname=org.elasticsearch.script.groovy.GroovyPlugin 32 | # 33 | # 'java.version': version of java the code is built against 34 | # use the system property java.specification.version 35 | # version string must be a sequence of nonnegative decimal integers 36 | # separated by "."'s and may have leading zeros 37 | java.version=1.8 38 | # 39 | # 'elasticsearch.version': version of elasticsearch compiled against 40 | elasticsearch.version=5.4.1 41 | ### optional elements for plugins: 42 | # 43 | # 'has.native.controller': whether or not the plugin has a native controller 44 | has.native.controller=false 45 | -------------------------------------------------------------------------------- /elasticsearch/modules/lang-groovy/plugin-security.policy: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to Elasticsearch under one or more contributor 3 | * license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright 5 | * ownership. Elasticsearch licenses this file to you under 6 | * the Apache License, Version 2.0 (the "License"); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | grant { 21 | // needed to generate runtime classes 22 | permission java.lang.RuntimePermission "createClassLoader"; 23 | // needed by IndyInterface 24 | permission java.lang.RuntimePermission "getClassLoader"; 25 | // needed by groovy engine 26 | permission java.lang.RuntimePermission "accessDeclaredMembers"; 27 | permission java.lang.RuntimePermission "accessClassInPackage.sun.reflect"; 28 | permission java.lang.RuntimePermission "accessClassInPackage.jdk.internal.reflect"; 29 | // Allow executing groovy scripts with codesource of /untrusted 30 | permission groovy.security.GroovyCodeSourcePermission "/untrusted"; 31 | 32 | // Standard set of classes 33 | permission org.elasticsearch.script.ClassPermission "<>"; 34 | // groovy runtime (TODO: clean these up if possible) 35 | permission org.elasticsearch.script.ClassPermission "groovy.grape.GrabAnnotationTransformation"; 36 | permission org.elasticsearch.script.ClassPermission "groovy.lang.Binding"; 37 | permission org.elasticsearch.script.ClassPermission "groovy.lang.GroovyObject"; 38 | permission org.elasticsearch.script.ClassPermission "groovy.lang.GString"; 39 | permission org.elasticsearch.script.ClassPermission "groovy.lang.Script"; 40 | permission org.elasticsearch.script.ClassPermission "groovy.util.GroovyCollections"; 41 | permission org.elasticsearch.script.ClassPermission "org.codehaus.groovy.ast.builder.AstBuilderTransformation"; 42 | permission org.elasticsearch.script.ClassPermission "org.codehaus.groovy.reflection.ClassInfo"; 43 | permission org.elasticsearch.script.ClassPermission "org.codehaus.groovy.runtime.GStringImpl"; 44 | permission org.elasticsearch.script.ClassPermission "org.codehaus.groovy.runtime.powerassert.ValueRecorder"; 45 | permission org.elasticsearch.script.ClassPermission "org.codehaus.groovy.runtime.powerassert.AssertionRenderer"; 46 | permission org.elasticsearch.script.ClassPermission "org.codehaus.groovy.runtime.ScriptBytecodeAdapter"; 47 | permission org.elasticsearch.script.ClassPermission "org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation"; 48 | permission org.elasticsearch.script.ClassPermission "org.codehaus.groovy.vmplugin.v7.IndyInterface"; 49 | permission org.elasticsearch.script.ClassPermission "sun.reflect.ConstructorAccessorImpl"; 50 | permission org.elasticsearch.script.ClassPermission "sun.reflect.MethodAccessorImpl"; 51 | permission org.elasticsearch.script.ClassPermission "jdk.internal.reflect.ConstructorAccessorImpl"; 52 | permission org.elasticsearch.script.ClassPermission "jdk.internal.reflect.MethodAccessorImpl"; 53 | 54 | permission org.elasticsearch.script.ClassPermission "groovy.lang.Closure"; 55 | permission org.elasticsearch.script.ClassPermission "org.codehaus.groovy.runtime.GeneratedClosure"; 56 | permission org.elasticsearch.script.ClassPermission "groovy.lang.MetaClass"; 57 | permission org.elasticsearch.script.ClassPermission "groovy.lang.Range"; 58 | permission org.elasticsearch.script.ClassPermission "groovy.lang.Reference"; 59 | }; 60 | -------------------------------------------------------------------------------- /elasticsearch/modules/lang-mustache/compiler-0.9.3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/modules/lang-mustache/compiler-0.9.3.jar -------------------------------------------------------------------------------- /elasticsearch/modules/lang-mustache/lang-mustache-5.4.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/modules/lang-mustache/lang-mustache-5.4.1.jar -------------------------------------------------------------------------------- /elasticsearch/modules/lang-mustache/plugin-descriptor.properties: -------------------------------------------------------------------------------- 1 | # Elasticsearch plugin descriptor file 2 | # This file must exist as 'plugin-descriptor.properties' in a folder named `elasticsearch` 3 | # inside all plugins. 4 | # 5 | ### example plugin for "foo" 6 | # 7 | # foo.zip <-- zip file for the plugin, with this structure: 8 | #|____elasticsearch/ 9 | #| |____ .jar <-- classes, resources, dependencies 10 | #| |____ .jar <-- any number of jars 11 | #| |____ plugin-descriptor.properties <-- example contents below: 12 | # 13 | # classname=foo.bar.BazPlugin 14 | # description=My cool plugin 15 | # version=2.0 16 | # elasticsearch.version=2.0 17 | # java.version=1.7 18 | # 19 | ### mandatory elements for all plugins: 20 | # 21 | # 'description': simple summary of the plugin 22 | description=Mustache scripting integration for Elasticsearch 23 | # 24 | # 'version': plugin's version 25 | version=5.4.1 26 | # 27 | # 'name': the plugin name 28 | name=lang-mustache 29 | # 30 | # 'classname': the name of the class to load, fully-qualified. 31 | classname=org.elasticsearch.script.mustache.MustachePlugin 32 | # 33 | # 'java.version': version of java the code is built against 34 | # use the system property java.specification.version 35 | # version string must be a sequence of nonnegative decimal integers 36 | # separated by "."'s and may have leading zeros 37 | java.version=1.8 38 | # 39 | # 'elasticsearch.version': version of elasticsearch compiled against 40 | elasticsearch.version=5.4.1 41 | ### optional elements for plugins: 42 | # 43 | # 'has.native.controller': whether or not the plugin has a native controller 44 | has.native.controller=false 45 | -------------------------------------------------------------------------------- /elasticsearch/modules/lang-mustache/plugin-security.policy: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to Elasticsearch under one or more contributor 3 | * license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright 5 | * ownership. Elasticsearch licenses this file to you under 6 | * the Apache License, Version 2.0 (the "License"); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | grant { 21 | // needed to do crazy reflection 22 | permission java.lang.RuntimePermission "accessDeclaredMembers"; 23 | }; 24 | -------------------------------------------------------------------------------- /elasticsearch/modules/lang-painless/antlr4-runtime-4.5.1-1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/modules/lang-painless/antlr4-runtime-4.5.1-1.jar -------------------------------------------------------------------------------- /elasticsearch/modules/lang-painless/asm-debug-all-5.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/modules/lang-painless/asm-debug-all-5.1.jar -------------------------------------------------------------------------------- /elasticsearch/modules/lang-painless/lang-painless-5.4.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/modules/lang-painless/lang-painless-5.4.1.jar -------------------------------------------------------------------------------- /elasticsearch/modules/lang-painless/plugin-descriptor.properties: -------------------------------------------------------------------------------- 1 | # Elasticsearch plugin descriptor file 2 | # This file must exist as 'plugin-descriptor.properties' in a folder named `elasticsearch` 3 | # inside all plugins. 4 | # 5 | ### example plugin for "foo" 6 | # 7 | # foo.zip <-- zip file for the plugin, with this structure: 8 | #|____elasticsearch/ 9 | #| |____ .jar <-- classes, resources, dependencies 10 | #| |____ .jar <-- any number of jars 11 | #| |____ plugin-descriptor.properties <-- example contents below: 12 | # 13 | # classname=foo.bar.BazPlugin 14 | # description=My cool plugin 15 | # version=2.0 16 | # elasticsearch.version=2.0 17 | # java.version=1.7 18 | # 19 | ### mandatory elements for all plugins: 20 | # 21 | # 'description': simple summary of the plugin 22 | description=An easy, safe and fast scripting language for Elasticsearch 23 | # 24 | # 'version': plugin's version 25 | version=5.4.1 26 | # 27 | # 'name': the plugin name 28 | name=lang-painless 29 | # 30 | # 'classname': the name of the class to load, fully-qualified. 31 | classname=org.elasticsearch.painless.PainlessPlugin 32 | # 33 | # 'java.version': version of java the code is built against 34 | # use the system property java.specification.version 35 | # version string must be a sequence of nonnegative decimal integers 36 | # separated by "."'s and may have leading zeros 37 | java.version=1.8 38 | # 39 | # 'elasticsearch.version': version of elasticsearch compiled against 40 | elasticsearch.version=5.4.1 41 | ### optional elements for plugins: 42 | # 43 | # 'has.native.controller': whether or not the plugin has a native controller 44 | has.native.controller=false 45 | -------------------------------------------------------------------------------- /elasticsearch/modules/lang-painless/plugin-security.policy: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to Elasticsearch under one or more contributor 3 | * license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright 5 | * ownership. Elasticsearch licenses this file to you under 6 | * the Apache License, Version 2.0 (the "License"); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | grant { 21 | // needed to generate runtime classes 22 | permission java.lang.RuntimePermission "createClassLoader"; 23 | }; 24 | -------------------------------------------------------------------------------- /elasticsearch/modules/percolator/percolator-5.4.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/modules/percolator/percolator-5.4.1.jar -------------------------------------------------------------------------------- /elasticsearch/modules/percolator/plugin-descriptor.properties: -------------------------------------------------------------------------------- 1 | # Elasticsearch plugin descriptor file 2 | # This file must exist as 'plugin-descriptor.properties' in a folder named `elasticsearch` 3 | # inside all plugins. 4 | # 5 | ### example plugin for "foo" 6 | # 7 | # foo.zip <-- zip file for the plugin, with this structure: 8 | #|____elasticsearch/ 9 | #| |____ .jar <-- classes, resources, dependencies 10 | #| |____ .jar <-- any number of jars 11 | #| |____ plugin-descriptor.properties <-- example contents below: 12 | # 13 | # classname=foo.bar.BazPlugin 14 | # description=My cool plugin 15 | # version=2.0 16 | # elasticsearch.version=2.0 17 | # java.version=1.7 18 | # 19 | ### mandatory elements for all plugins: 20 | # 21 | # 'description': simple summary of the plugin 22 | description=Percolator module adds capability to index queries and query these queries by specifying documents 23 | # 24 | # 'version': plugin's version 25 | version=5.4.1 26 | # 27 | # 'name': the plugin name 28 | name=percolator 29 | # 30 | # 'classname': the name of the class to load, fully-qualified. 31 | classname=org.elasticsearch.percolator.PercolatorPlugin 32 | # 33 | # 'java.version': version of java the code is built against 34 | # use the system property java.specification.version 35 | # version string must be a sequence of nonnegative decimal integers 36 | # separated by "."'s and may have leading zeros 37 | java.version=1.8 38 | # 39 | # 'elasticsearch.version': version of elasticsearch compiled against 40 | elasticsearch.version=5.4.1 41 | ### optional elements for plugins: 42 | # 43 | # 'has.native.controller': whether or not the plugin has a native controller 44 | has.native.controller=false 45 | -------------------------------------------------------------------------------- /elasticsearch/modules/reindex/commons-codec-1.10.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/modules/reindex/commons-codec-1.10.jar -------------------------------------------------------------------------------- /elasticsearch/modules/reindex/commons-logging-1.1.3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/modules/reindex/commons-logging-1.1.3.jar -------------------------------------------------------------------------------- /elasticsearch/modules/reindex/httpasyncclient-4.1.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/modules/reindex/httpasyncclient-4.1.2.jar -------------------------------------------------------------------------------- /elasticsearch/modules/reindex/httpclient-4.5.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/modules/reindex/httpclient-4.5.2.jar -------------------------------------------------------------------------------- /elasticsearch/modules/reindex/httpcore-4.4.5.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/modules/reindex/httpcore-4.4.5.jar -------------------------------------------------------------------------------- /elasticsearch/modules/reindex/httpcore-nio-4.4.5.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/modules/reindex/httpcore-nio-4.4.5.jar -------------------------------------------------------------------------------- /elasticsearch/modules/reindex/plugin-descriptor.properties: -------------------------------------------------------------------------------- 1 | # Elasticsearch plugin descriptor file 2 | # This file must exist as 'plugin-descriptor.properties' in a folder named `elasticsearch` 3 | # inside all plugins. 4 | # 5 | ### example plugin for "foo" 6 | # 7 | # foo.zip <-- zip file for the plugin, with this structure: 8 | #|____elasticsearch/ 9 | #| |____ .jar <-- classes, resources, dependencies 10 | #| |____ .jar <-- any number of jars 11 | #| |____ plugin-descriptor.properties <-- example contents below: 12 | # 13 | # classname=foo.bar.BazPlugin 14 | # description=My cool plugin 15 | # version=2.0 16 | # elasticsearch.version=2.0 17 | # java.version=1.7 18 | # 19 | ### mandatory elements for all plugins: 20 | # 21 | # 'description': simple summary of the plugin 22 | description=The Reindex module adds APIs to reindex from one index to another or update documents in place. 23 | # 24 | # 'version': plugin's version 25 | version=5.4.1 26 | # 27 | # 'name': the plugin name 28 | name=reindex 29 | # 30 | # 'classname': the name of the class to load, fully-qualified. 31 | classname=org.elasticsearch.index.reindex.ReindexPlugin 32 | # 33 | # 'java.version': version of java the code is built against 34 | # use the system property java.specification.version 35 | # version string must be a sequence of nonnegative decimal integers 36 | # separated by "."'s and may have leading zeros 37 | java.version=1.8 38 | # 39 | # 'elasticsearch.version': version of elasticsearch compiled against 40 | elasticsearch.version=5.4.1 41 | ### optional elements for plugins: 42 | # 43 | # 'has.native.controller': whether or not the plugin has a native controller 44 | has.native.controller=false 45 | -------------------------------------------------------------------------------- /elasticsearch/modules/reindex/reindex-5.4.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/modules/reindex/reindex-5.4.1.jar -------------------------------------------------------------------------------- /elasticsearch/modules/reindex/rest-5.4.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/modules/reindex/rest-5.4.1.jar -------------------------------------------------------------------------------- /elasticsearch/modules/transport-netty3/netty-3.10.6.Final.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/modules/transport-netty3/netty-3.10.6.Final.jar -------------------------------------------------------------------------------- /elasticsearch/modules/transport-netty3/plugin-descriptor.properties: -------------------------------------------------------------------------------- 1 | # Elasticsearch plugin descriptor file 2 | # This file must exist as 'plugin-descriptor.properties' in a folder named `elasticsearch` 3 | # inside all plugins. 4 | # 5 | ### example plugin for "foo" 6 | # 7 | # foo.zip <-- zip file for the plugin, with this structure: 8 | #|____elasticsearch/ 9 | #| |____ .jar <-- classes, resources, dependencies 10 | #| |____ .jar <-- any number of jars 11 | #| |____ plugin-descriptor.properties <-- example contents below: 12 | # 13 | # classname=foo.bar.BazPlugin 14 | # description=My cool plugin 15 | # version=2.0 16 | # elasticsearch.version=2.0 17 | # java.version=1.7 18 | # 19 | ### mandatory elements for all plugins: 20 | # 21 | # 'description': simple summary of the plugin 22 | description=Netty 3 based transport implementation 23 | # 24 | # 'version': plugin's version 25 | version=5.4.1 26 | # 27 | # 'name': the plugin name 28 | name=transport-netty3 29 | # 30 | # 'classname': the name of the class to load, fully-qualified. 31 | classname=org.elasticsearch.transport.Netty3Plugin 32 | # 33 | # 'java.version': version of java the code is built against 34 | # use the system property java.specification.version 35 | # version string must be a sequence of nonnegative decimal integers 36 | # separated by "."'s and may have leading zeros 37 | java.version=1.8 38 | # 39 | # 'elasticsearch.version': version of elasticsearch compiled against 40 | elasticsearch.version=5.4.1 41 | ### optional elements for plugins: 42 | # 43 | # 'has.native.controller': whether or not the plugin has a native controller 44 | has.native.controller=false 45 | -------------------------------------------------------------------------------- /elasticsearch/modules/transport-netty3/plugin-security.policy: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to Elasticsearch under one or more contributor 3 | * license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright 5 | * ownership. Elasticsearch licenses this file to you under 6 | * the Apache License, Version 2.0 (the "License"); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | grant { 21 | // Netty SelectorUtil wants to change this, because of https://bugs.openjdk.java.net/browse/JDK-6427854 22 | // the bug says it only happened rarely, and that its fixed, but apparently it still happens rarely! 23 | permission java.util.PropertyPermission "sun.nio.ch.bugLevel", "write"; 24 | }; -------------------------------------------------------------------------------- /elasticsearch/modules/transport-netty3/transport-netty3-5.4.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/modules/transport-netty3/transport-netty3-5.4.1.jar -------------------------------------------------------------------------------- /elasticsearch/modules/transport-netty4/netty-buffer-4.1.11.Final.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/modules/transport-netty4/netty-buffer-4.1.11.Final.jar -------------------------------------------------------------------------------- /elasticsearch/modules/transport-netty4/netty-codec-4.1.11.Final.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/modules/transport-netty4/netty-codec-4.1.11.Final.jar -------------------------------------------------------------------------------- /elasticsearch/modules/transport-netty4/netty-codec-http-4.1.11.Final.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/modules/transport-netty4/netty-codec-http-4.1.11.Final.jar -------------------------------------------------------------------------------- /elasticsearch/modules/transport-netty4/netty-common-4.1.11.Final.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/modules/transport-netty4/netty-common-4.1.11.Final.jar -------------------------------------------------------------------------------- /elasticsearch/modules/transport-netty4/netty-handler-4.1.11.Final.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/modules/transport-netty4/netty-handler-4.1.11.Final.jar -------------------------------------------------------------------------------- /elasticsearch/modules/transport-netty4/netty-resolver-4.1.11.Final.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/modules/transport-netty4/netty-resolver-4.1.11.Final.jar -------------------------------------------------------------------------------- /elasticsearch/modules/transport-netty4/netty-transport-4.1.11.Final.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/modules/transport-netty4/netty-transport-4.1.11.Final.jar -------------------------------------------------------------------------------- /elasticsearch/modules/transport-netty4/plugin-descriptor.properties: -------------------------------------------------------------------------------- 1 | # Elasticsearch plugin descriptor file 2 | # This file must exist as 'plugin-descriptor.properties' in a folder named `elasticsearch` 3 | # inside all plugins. 4 | # 5 | ### example plugin for "foo" 6 | # 7 | # foo.zip <-- zip file for the plugin, with this structure: 8 | #|____elasticsearch/ 9 | #| |____ .jar <-- classes, resources, dependencies 10 | #| |____ .jar <-- any number of jars 11 | #| |____ plugin-descriptor.properties <-- example contents below: 12 | # 13 | # classname=foo.bar.BazPlugin 14 | # description=My cool plugin 15 | # version=2.0 16 | # elasticsearch.version=2.0 17 | # java.version=1.7 18 | # 19 | ### mandatory elements for all plugins: 20 | # 21 | # 'description': simple summary of the plugin 22 | description=Netty 4 based transport implementation 23 | # 24 | # 'version': plugin's version 25 | version=5.4.1 26 | # 27 | # 'name': the plugin name 28 | name=transport-netty4 29 | # 30 | # 'classname': the name of the class to load, fully-qualified. 31 | classname=org.elasticsearch.transport.Netty4Plugin 32 | # 33 | # 'java.version': version of java the code is built against 34 | # use the system property java.specification.version 35 | # version string must be a sequence of nonnegative decimal integers 36 | # separated by "."'s and may have leading zeros 37 | java.version=1.8 38 | # 39 | # 'elasticsearch.version': version of elasticsearch compiled against 40 | elasticsearch.version=5.4.1 41 | ### optional elements for plugins: 42 | # 43 | # 'has.native.controller': whether or not the plugin has a native controller 44 | has.native.controller=false 45 | -------------------------------------------------------------------------------- /elasticsearch/modules/transport-netty4/plugin-security.policy: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to Elasticsearch under one or more contributor 3 | * license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright 5 | * ownership. Elasticsearch licenses this file to you under 6 | * the Apache License, Version 2.0 (the "License"); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | grant codeBase "${codebase.netty-common-4.1.11.Final.jar}" { 21 | // for reading the system-wide configuration for the backlog of established sockets 22 | permission java.io.FilePermission "/proc/sys/net/core/somaxconn", "read"; 23 | }; 24 | 25 | grant codeBase "${codebase.netty-transport-4.1.11.Final.jar}" { 26 | // Netty NioEventLoop wants to change this, because of https://bugs.openjdk.java.net/browse/JDK-6427854 27 | // the bug says it only happened rarely, and that its fixed, but apparently it still happens rarely! 28 | permission java.util.PropertyPermission "sun.nio.ch.bugLevel", "write"; 29 | }; 30 | -------------------------------------------------------------------------------- /elasticsearch/modules/transport-netty4/transport-netty4-5.4.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/look/query-parser/6049469db352f937d0d88300dd0986b86b14e3b3/elasticsearch/modules/transport-netty4/transport-netty4-5.4.1.jar -------------------------------------------------------------------------------- /elasticsearch_helpers.rb: -------------------------------------------------------------------------------- 1 | require 'elasticsearch' 2 | 3 | module ElasticsearchHelpers 4 | def self.client 5 | @client ||= Elasticsearch::Client.new(:log => true) 6 | end 7 | 8 | def self.search(query_dsl) 9 | client.search(:index => 'query_parser_test', :type => 'books', :body => query_dsl) 10 | end 11 | 12 | def self.create_index! 13 | if client.indices.exists?(:index => 'query_parser_test') 14 | client.indices.delete(:index => 'query_parser_test') 15 | end 16 | 17 | client.indices.create(:index => 'query_parser_test', 18 | :body => { 19 | :settings => { 20 | :index => { 21 | :mapper => { 22 | :dynamic => false 23 | } 24 | } 25 | }, 26 | :mappings => { 27 | :books => { 28 | :_all => { :enabled => false }, 29 | :properties => { 30 | :title => { 31 | :type => 'text', 32 | :analyzer => 'standard' 33 | }, 34 | :author => { 35 | :type => 'text', 36 | :analyzer => 'standard' 37 | }, 38 | :publication_year => { 39 | :type => 'integer' 40 | } 41 | } 42 | } 43 | } 44 | }) 45 | end 46 | 47 | def self.prepare_corpus! 48 | create_index! 49 | index_documents 50 | wait_for_indexing 51 | end 52 | 53 | # It takes a moment for documents to become available for search 54 | def self.wait_for_indexing 55 | retries = 0 56 | loop do 57 | results = search(:query => {:match_all => {}}) 58 | 59 | if results['hits']['hits'].size == corpus.size 60 | break 61 | end 62 | 63 | if retries > 5 64 | raise "Error indexing corpus. Got these results: #{results}" 65 | end 66 | 67 | retries += 1 68 | sleep(0.5) 69 | end 70 | end 71 | 72 | def self.corpus 73 | [ 74 | {:title => "The Cat in the Hat", :author => ["Theodor Geisel", "Doctor Seuss"], :publication_year => 1957}, 75 | {:title => "Cat Sense", :author => "John Bradshaw", :publication_year => 2013}, 76 | {:title => "How to Tell If Your Cat Is Plotting to Kill You", :author => "Matthew Inman", :publication_year => 2012} 77 | ] 78 | end 79 | 80 | def self.index_documents 81 | corpus.each_with_index do |doc, index| 82 | client.index(:index => 'query_parser_test', 83 | :type => 'books', 84 | :id => index, 85 | :body => doc) 86 | 87 | end 88 | end 89 | end 90 | -------------------------------------------------------------------------------- /heuristic_parser.rb: -------------------------------------------------------------------------------- 1 | require 'parslet' 2 | 3 | module HeuristicParser 4 | # This query parser is a simple example of going beyond generic query parsing. 5 | # It adds a new clause type for date ranges. The parser recognizes strings 6 | # like "1920s" or "2010" as dates instead of generic terms. 7 | class QueryParser < Parslet::Parser 8 | rule(:eof) { any.absent? } 9 | rule(:decade) do 10 | ((str('1') >> str('9') | 11 | str('2') >> str('0')) >> 12 | match('\d') >> str('0')).as(:decade) >> 13 | str('s').maybe >> (eof | space).present? 14 | end 15 | rule(:term) { match('[^\s"]').repeat(1).as(:term) } 16 | rule(:quote) { str('"') } 17 | rule(:operator) { (str('+') | str('-')).as(:operator) } 18 | rule(:phrase) do 19 | (quote >> (term >> space.maybe).repeat >> quote).as(:phrase) 20 | end 21 | rule(:clause) { (operator.maybe >> (phrase | decade | term)).as(:clause) } 22 | rule(:space) { match('\s').repeat(1) } 23 | rule(:query) { (clause >> space.maybe).repeat.as(:query) } 24 | root(:query) 25 | end 26 | 27 | class QueryTransformer < Parslet::Transform 28 | rule(:clause => subtree(:clause)) do 29 | if clause[:term] 30 | TermClause.new(clause[:operator]&.to_s, clause[:term].to_s) 31 | elsif clause[:phrase] 32 | PhraseClause.new(clause[:operator]&.to_s, clause[:phrase].map { |p| p[:term].to_s }.join(" ")) 33 | elsif clause[:decade] 34 | DateRangeClause.new(clause[:operator]&.to_s, Integer(clause[:decade])) 35 | else 36 | raise "Unexpected clause type: '#{clause}'" 37 | end 38 | end 39 | rule(:query => sequence(:clauses)) { Query.new(clauses) } 40 | end 41 | 42 | class Operator 43 | def self.symbol(str) 44 | case str 45 | when '+' 46 | :must 47 | when '-' 48 | :must_not 49 | when nil 50 | :should 51 | else 52 | raise "Unknown operator: #{str}" 53 | end 54 | end 55 | end 56 | 57 | class TermClause 58 | attr_accessor :operator, :term 59 | 60 | def initialize(operator, term) 61 | self.operator = Operator.symbol(operator) 62 | self.term = term 63 | end 64 | end 65 | 66 | class PhraseClause 67 | attr_accessor :operator, :phrase 68 | 69 | def initialize(operator, phrase) 70 | self.operator = Operator.symbol(operator) 71 | self.phrase = phrase 72 | end 73 | end 74 | 75 | class DateRangeClause 76 | attr_accessor :operator, :start_year, :end_year 77 | 78 | def initialize(operator, decade) 79 | self.operator = Operator.symbol(operator) 80 | self.start_year = decade 81 | self.end_year = decade + 9 82 | end 83 | end 84 | 85 | class Query 86 | attr_accessor :should_clauses, :must_not_clauses, :must_clauses 87 | 88 | def self.elasticsearch_query_for(query_string) 89 | tree = QueryParser.new.parse(query_string) 90 | query = QueryTransformer.new.apply(tree) 91 | query.to_elasticsearch 92 | end 93 | 94 | def initialize(clauses) 95 | self.should_clauses = clauses.select { |c| c.operator == :should } 96 | self.must_not_clauses = clauses.select { |c| c.operator == :must_not } 97 | self.must_clauses = clauses.select { |c| c.operator == :must } 98 | end 99 | 100 | def to_elasticsearch 101 | query = { 102 | :query => { 103 | :bool => { 104 | } 105 | } 106 | } 107 | 108 | if should_clauses.any? 109 | query[:query][:bool][:should] = should_clauses.map { |clause| clause_to_query(clause) } 110 | end 111 | 112 | if must_clauses.any? 113 | query[:query][:bool][:must] = must_clauses.map { |clause| clause_to_query(clause) } 114 | end 115 | 116 | if must_not_clauses.any? 117 | query[:query][:bool][:must_not] = must_not_clauses.map { |clause| clause_to_query(clause) } 118 | end 119 | 120 | query 121 | end 122 | 123 | def clause_to_query(clause) 124 | case clause 125 | when TermClause 126 | match(clause.term) 127 | when PhraseClause 128 | match_phrase(clause.phrase) 129 | when DateRangeClause 130 | date_range(clause.start_year, clause.end_year) 131 | else 132 | raise "Unknown clause type: #{clause}" 133 | end 134 | end 135 | 136 | def match(term) 137 | { 138 | :match => { 139 | :title => { 140 | :query => term 141 | } 142 | } 143 | } 144 | end 145 | 146 | def match_phrase(phrase) 147 | { 148 | :match_phrase => { 149 | :title => { 150 | :query => phrase 151 | } 152 | } 153 | } 154 | end 155 | 156 | def date_range(start_year, end_year) 157 | { 158 | :range => { 159 | :publication_year => { 160 | :gte => start_year, 161 | :lte => end_year 162 | } 163 | } 164 | } 165 | end 166 | end 167 | end 168 | -------------------------------------------------------------------------------- /phrase_parser.rb: -------------------------------------------------------------------------------- 1 | require 'parslet' 2 | 3 | module PhraseParser 4 | # This parser adds quoted phrases (using matched double quotes) in addition to 5 | # terms. This is done creating multiple types of clauses instead of just one. 6 | # A phrase clause generates an Elasticsearch match_phrase query. 7 | class QueryParser < Parslet::Parser 8 | rule(:term) { match('[^\s"]').repeat(1).as(:term) } 9 | rule(:quote) { str('"') } 10 | rule(:operator) { (str('+') | str('-')).as(:operator) } 11 | rule(:phrase) do 12 | (quote >> (term >> space.maybe).repeat >> quote).as(:phrase) 13 | end 14 | rule(:clause) { (operator.maybe >> (phrase | term)).as(:clause) } 15 | rule(:space) { match('\s').repeat(1) } 16 | rule(:query) { (clause >> space.maybe).repeat.as(:query) } 17 | root(:query) 18 | end 19 | 20 | class QueryTransformer < Parslet::Transform 21 | rule(:clause => subtree(:clause)) do 22 | if clause[:term] 23 | TermClause.new(clause[:operator]&.to_s, clause[:term].to_s) 24 | elsif clause[:phrase] 25 | phrase = clause[:phrase].map { |p| p[:term].to_s }.join(" ") 26 | PhraseClause.new(clause[:operator]&.to_s, phrase) 27 | else 28 | raise "Unexpected clause type: '#{clause}'" 29 | end 30 | end 31 | rule(:query => sequence(:clauses)) { Query.new(clauses) } 32 | end 33 | 34 | class Operator 35 | def self.symbol(str) 36 | case str 37 | when '+' 38 | :must 39 | when '-' 40 | :must_not 41 | when nil 42 | :should 43 | else 44 | raise "Unknown operator: #{str}" 45 | end 46 | end 47 | end 48 | 49 | class TermClause 50 | attr_accessor :operator, :term 51 | 52 | def initialize(operator, term) 53 | self.operator = Operator.symbol(operator) 54 | self.term = term 55 | end 56 | end 57 | 58 | class PhraseClause 59 | attr_accessor :operator, :phrase 60 | 61 | def initialize(operator, phrase) 62 | self.operator = Operator.symbol(operator) 63 | self.phrase = phrase 64 | end 65 | end 66 | 67 | class Query 68 | attr_accessor :should_clauses, :must_not_clauses, :must_clauses 69 | 70 | def initialize(clauses) 71 | grouped = clauses.chunk { |c| c.operator }.to_h 72 | self.should_clauses = grouped.fetch(:should, []) 73 | self.must_not_clauses = grouped.fetch(:must_not, []) 74 | self.must_clauses = grouped.fetch(:must, []) 75 | end 76 | 77 | def to_elasticsearch 78 | query = { 79 | :query => { 80 | :bool => { 81 | } 82 | } 83 | } 84 | 85 | if should_clauses.any? 86 | query[:query][:bool][:should] = should_clauses.map do |clause| 87 | clause_to_query(clause) 88 | end 89 | end 90 | 91 | if must_clauses.any? 92 | query[:query][:bool][:must] = must_clauses.map do |clause| 93 | clause_to_query(clause) 94 | end 95 | end 96 | 97 | if must_not_clauses.any? 98 | query[:query][:bool][:must_not] = must_not_clauses.map do |clause| 99 | clause_to_query(clause) 100 | end 101 | end 102 | 103 | query 104 | end 105 | 106 | def clause_to_query(clause) 107 | case clause 108 | when TermClause 109 | match(clause.term) 110 | when PhraseClause 111 | match_phrase(clause.phrase) 112 | else 113 | raise "Unknown clause type: #{clause}" 114 | end 115 | end 116 | 117 | def match(term) 118 | { 119 | :match => { 120 | :title => { 121 | :query => term 122 | } 123 | } 124 | } 125 | end 126 | 127 | def match_phrase(phrase) 128 | { 129 | :match_phrase => { 130 | :title => { 131 | :query => phrase 132 | } 133 | } 134 | } 135 | end 136 | end 137 | end 138 | -------------------------------------------------------------------------------- /term_parser.rb: -------------------------------------------------------------------------------- 1 | require 'parslet' 2 | 3 | module TermParser 4 | # This is a simple parser that matches a sequence of non-whitespace characters 5 | # and converts it to an Elasticsearch match query. 6 | class QueryParser < Parslet::Parser 7 | rule(:term) { match('[^\s]').repeat(1).as(:term) } 8 | rule(:space) { match('\s').repeat(1) } 9 | rule(:query) { (term >> space.maybe).repeat.as(:query) } 10 | root(:query) 11 | end 12 | 13 | class QueryTransformer < Parslet::Transform 14 | rule(:term => simple(:term)) { term.to_s } 15 | rule(:query => sequence(:terms)) { Query.new(terms) } 16 | end 17 | 18 | # A query represented by a list of parsed user terms 19 | class Query 20 | attr_accessor :terms 21 | 22 | def initialize(terms) 23 | self.terms = terms 24 | end 25 | 26 | def to_elasticsearch 27 | { 28 | :query => { 29 | :match => { 30 | :title => { 31 | :query => terms.join(" "), 32 | :operator => "or" 33 | } 34 | } 35 | } 36 | } 37 | end 38 | end 39 | end 40 | -------------------------------------------------------------------------------- /tests/boolean_term_parser_tests.rb: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | require 'minitest/autorun' 3 | require_relative '../boolean_term_parser' 4 | 5 | class BooleanTermParserTests < Minitest::Test 6 | def test_single_term 7 | tree = BooleanTermParser::QueryParser.new.parse('foo') 8 | assert_equal({:query => [{:clause => {:term => 'foo'}}]}, tree) 9 | end 10 | 11 | def test_single_term_with_operator 12 | tree = BooleanTermParser::QueryParser.new.parse('-foo') 13 | assert_equal({:query => [{:clause => {:operator => '-', :term => 'foo'}}]}, tree) 14 | end 15 | 16 | def test_multiple_terms 17 | tree = BooleanTermParser::QueryParser.new.parse('foo bar baz') 18 | expected = {:query => [{:clause => {:term => 'foo'}}, 19 | {:clause => {:term => 'bar'}}, 20 | {:clause => {:term => 'baz'}}]} 21 | assert_equal(expected, tree) 22 | end 23 | 24 | def test_multiple_terms_with_operators 25 | tree = BooleanTermParser::QueryParser.new.parse("foo +bar +baz -cat") 26 | expected = {:query => [{:clause => {:term => 'foo'}}, 27 | {:clause => {:operator => '+', :term => 'bar'}}, 28 | {:clause => {:operator => '+', :term => 'baz'}}, 29 | {:clause => {:operator => '-', :term => 'cat'}}]} 30 | assert_equal(expected, tree) 31 | end 32 | 33 | def test_non_ascii_characters 34 | tree = BooleanTermParser::QueryParser.new.parse('+føé -ba∑ ∫åñ') 35 | expected = {:query => [{:clause => {:operator => '+', :term => 'føé'}}, 36 | {:clause => {:operator => '-', :term => 'ba∑'}}, 37 | {:clause => {:term => '∫åñ'}}]} 38 | assert_equal(expected, tree) 39 | end 40 | 41 | def test_operators_in_terms 42 | tree = BooleanTermParser::QueryParser.new.parse('-foo+term +bar-term baz-term') 43 | expected = {:query => [{:clause => {:operator => '-', :term => 'foo+term'}}, 44 | {:clause => {:operator => '+', :term => 'bar-term'}}, 45 | {:clause => {:term => 'baz-term'}}]} 46 | assert_equal(expected, tree) 47 | end 48 | 49 | def test_quotation_marks 50 | tree = BooleanTermParser::QueryParser.new.parse('+fo"o -ba"r') 51 | expected = {:query => [{:clause => {:operator => '+', :term => 'fo"o'}}, 52 | {:clause => {:operator => '-', :term => 'ba"r'}}]} 53 | assert_equal(expected, tree) 54 | end 55 | end 56 | -------------------------------------------------------------------------------- /tests/boolean_term_transformer_tests.rb: -------------------------------------------------------------------------------- 1 | require 'minitest/autorun' 2 | require_relative '../boolean_term_parser' 3 | 4 | class BooleanTermTransformerTests < Minitest::Test 5 | def test_boolean_term_transformer 6 | parsed_query = { 7 | :query => [ 8 | { 9 | :clause => { 10 | :operator => '-', 11 | :term => 'cat' 12 | } 13 | }, 14 | { 15 | :clause => { 16 | :term => 'hat' 17 | } 18 | } 19 | ] 20 | } 21 | 22 | boolean_term_query = BooleanTermParser::QueryTransformer.new.apply(parsed_query) 23 | 24 | assert_equal(0, boolean_term_query.must_terms.size) 25 | assert_equal(['hat'], boolean_term_query.should_terms) 26 | assert_equal(['cat'], boolean_term_query.must_not_terms) 27 | end 28 | end 29 | -------------------------------------------------------------------------------- /tests/heuristic_parser_tests.rb: -------------------------------------------------------------------------------- 1 | require 'minitest/autorun' 2 | require_relative '../heuristic_parser' 3 | 4 | class HeuristicParserTest < Minitest::Test 5 | def test_date_range 6 | tree = HeuristicParser::QueryParser.new.parse("1990s 2010") 7 | assert_equal({:query => [{:clause => {:decade => '1990'}}, {:clause => {:decade => '2010'}}]}, tree) 8 | end 9 | 10 | def test_complex_query 11 | tree = HeuristicParser::QueryParser.new.parse('+paw-some "cat videos" -2000s') 12 | expected = {:query => [{:clause => {:operator => '+', :term => 'paw-some'}}, 13 | {:clause => {:phrase => [{:term => 'cat'}, {:term => 'videos'}]}}, 14 | {:clause => {:operator => '-', :decade => '2000'}}]} 15 | 16 | assert_equal(expected, tree) 17 | end 18 | 19 | def test_term_prefixed_with_decade 20 | tree = HeuristicParser::QueryParser.new.parse('2000st') 21 | expected = {:query => [{:clause => {:term => '2000st'}}]} 22 | assert_equal(expected, tree) 23 | end 24 | 25 | def test_term_suffixed_with_decade 26 | tree = HeuristicParser::QueryParser.new.parse('st2000') 27 | expected = {:query => [{:clause => {:term => 'st2000'}}]} 28 | assert_equal(expected, tree) 29 | end 30 | 31 | def test_non_decade_parsed_as_term 32 | tree = HeuristicParser::QueryParser.new.parse('2001') 33 | expected = {:query => [{:clause => {:term => '2001'}}]} 34 | assert_equal(expected, tree) 35 | end 36 | end 37 | -------------------------------------------------------------------------------- /tests/heuristic_transformer_tests.rb: -------------------------------------------------------------------------------- 1 | require 'minitest/autorun' 2 | require_relative '../heuristic_parser' 3 | 4 | class HeuristicTransformerTest < Minitest::Test 5 | def test_heuristic_transformer 6 | parsed_query = { 7 | :query => [ 8 | {:clause => {:term => 'awesome'}}, 9 | {:clause => {:phrase => [{:term => 'cat'}, {:term => 'videos'}]}}, 10 | {:clause => {:operator => '-', :decade => '2000'}} 11 | ] 12 | } 13 | 14 | query = HeuristicParser::QueryTransformer.new.apply(parsed_query) 15 | assert(query.should_clauses.size, 2) 16 | assert(query.must_clauses.size, 0) 17 | assert(query.must_not_clauses.size, 1) 18 | assert_equal('awesome', query.should_clauses.first.term) 19 | assert_equal('cat videos', query.should_clauses[1].phrase) 20 | assert_equal(2000, query.must_not_clauses.first.start_year) 21 | assert_equal(2009, query.must_not_clauses.first.end_year) 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /tests/integration/search_tests.rb: -------------------------------------------------------------------------------- 1 | require 'minitest/autorun' 2 | require_relative '../../heuristic_parser' 3 | require_relative '../../elasticsearch_helpers' 4 | 5 | class SearchTests < Minitest::Test 6 | 7 | def self.configure_es 8 | return if defined?(@configured) 9 | 10 | ElasticsearchHelpers.prepare_corpus! 11 | 12 | @configured = true 13 | end 14 | 15 | def setup 16 | self.class.configure_es 17 | end 18 | 19 | def test_query 20 | query_dsl = HeuristicParser::Query.elasticsearch_query_for('kill "cat is plotting"') 21 | results = ElasticsearchHelpers.search(query_dsl) 22 | 23 | hits = results.fetch('hits').fetch('hits') 24 | assert_equal(1, hits.size) 25 | assert_equal('How to Tell If Your Cat Is Plotting to Kill You', hits.first.fetch('_source').fetch('title')) 26 | end 27 | 28 | def test_negation_query 29 | query_dsl = HeuristicParser::Query.elasticsearch_query_for('cat -hat') 30 | results = ElasticsearchHelpers.search(query_dsl) 31 | 32 | hits = results.fetch('hits').fetch('hits') 33 | assert_equal(2, hits.size) 34 | titles = hits.map { |h| h.fetch('_source').fetch('title') } 35 | refute_includes(titles, 'The Cat in the Hat') 36 | end 37 | 38 | def test_date_range_query 39 | query_dsl = HeuristicParser::Query.elasticsearch_query_for('1950s') 40 | results = ElasticsearchHelpers.search(query_dsl) 41 | 42 | hits = results.fetch('hits').fetch('hits') 43 | assert_equal(1, hits.size) 44 | assert_equal('The Cat in the Hat', hits.first.fetch('_source').fetch('title')) 45 | end 46 | 47 | def test_negation_date_range_query 48 | query_dsl = HeuristicParser::Query.elasticsearch_query_for('-2010') 49 | results = ElasticsearchHelpers.search(query_dsl) 50 | 51 | hits = results.fetch('hits').fetch('hits') 52 | assert_equal(1, hits.size) 53 | assert_equal('The Cat in the Hat', hits.first.fetch('_source').fetch('title')) 54 | end 55 | end 56 | -------------------------------------------------------------------------------- /tests/phrase_parser_tests.rb: -------------------------------------------------------------------------------- 1 | require 'minitest/autorun' 2 | require_relative '../phrase_parser' 3 | 4 | class PhraseParserTests < Minitest::Test 5 | def test_simple_query 6 | tree = PhraseParser::QueryParser.new.parse('foo') 7 | expected = { 8 | :query => [ 9 | {:clause => {:term => 'foo'}} 10 | ] 11 | } 12 | assert_equal(expected, tree) 13 | end 14 | 15 | def test_negation_query 16 | tree = PhraseParser::QueryParser.new.parse('-foo') 17 | expected = { 18 | :query => [ 19 | {:clause => {:operator => '-', :term => 'foo'}} 20 | ] 21 | } 22 | assert_equal(expected, tree) 23 | end 24 | 25 | def test_single_word_phrase 26 | tree = PhraseParser::QueryParser.new.parse('"foo"') 27 | expected = { 28 | :query => [ 29 | {:clause => {:phrase => [{:term => 'foo'}]}} 30 | ] 31 | } 32 | assert_equal(expected, tree) 33 | end 34 | 35 | def test_single_phrase 36 | tree = PhraseParser::QueryParser.new.parse('"foo bar"') 37 | expected = { 38 | :query => [ 39 | {:clause => {:phrase => [{:term => 'foo'}, {:term => 'bar'}]}} 40 | ] 41 | } 42 | assert_equal(expected, tree) 43 | end 44 | 45 | def test_complex_query 46 | tree = PhraseParser::QueryParser.new.parse('foo -bar +"hello" -"cat in the hat"') 47 | expected = { 48 | :query => [ 49 | { 50 | :clause => {:term => 'foo'} 51 | }, 52 | { 53 | :clause => {:operator => '-', :term => 'bar'} 54 | }, 55 | { 56 | :clause => { 57 | :operator => '+', 58 | :phrase => [{:term => 'hello'}] 59 | } 60 | }, 61 | { 62 | :clause => { 63 | :operator => '-', 64 | :phrase => [{:term => 'cat'}, {:term => 'in'}, {:term => 'the'}, {:term => 'hat'}] 65 | } 66 | } 67 | ] 68 | } 69 | 70 | assert_equal(expected, tree) 71 | end 72 | 73 | def test_mismatched_quotation_marks 74 | assert_raises Parslet::ParseFailed do 75 | PhraseParser::QueryParser.new.parse('"foo') 76 | end 77 | end 78 | 79 | def test_quotation_mark_in_term 80 | assert_raises Parslet::ParseFailed do 81 | PhraseParser::QueryParser.new.parse('fo"o') 82 | end 83 | end 84 | 85 | def test_mismatched_quotation_mark_delimiter 86 | # We'll call this a "feature" since the quotation marks are balanced. 87 | # If you don't want this, you can use lookahead to ensure end-quote is followed by a space or EOF 88 | tree = PhraseParser::QueryParser.new.parse('"foo"+bar"baz"') 89 | expected = {:query => [{:clause => {:phrase => [{:term => 'foo'}]}}, 90 | {:clause => {:operator => '+', :term => 'bar'}}, 91 | {:clause => {:phrase => [{:term => 'baz'}]}}]} 92 | assert_equal(expected, tree) 93 | end 94 | end 95 | -------------------------------------------------------------------------------- /tests/phrase_transformer_tests.rb: -------------------------------------------------------------------------------- 1 | require 'minitest/autorun' 2 | require_relative '../phrase_parser' 3 | 4 | class PhraseTransformerTests < Minitest::Test 5 | def test_phrase_transformer 6 | parsed_query = { 7 | :query => [ 8 | { 9 | :clause => { 10 | :operator => "+", :term => "foo" 11 | } 12 | }, 13 | { 14 | :clause => { 15 | :term => "bar" 16 | } 17 | }, 18 | { 19 | :clause => { 20 | :operator => "-", 21 | :phrase => [ 22 | {:term => "cat"}, 23 | {:term => "in"}, 24 | {:term => "the"}, 25 | {:term => "hat"} 26 | ] 27 | } 28 | } 29 | ] 30 | } 31 | 32 | phrase_query = PhraseParser::QueryTransformer.new.apply(parsed_query) 33 | 34 | assert(phrase_query.should_clauses.size, 1) 35 | assert(phrase_query.must_clauses.size, 1) 36 | assert(phrase_query.must_not_clauses.size, 1) 37 | assert_equal("foo", phrase_query.must_clauses.first.term) 38 | assert_equal("bar", phrase_query.should_clauses.first.term) 39 | assert_equal("cat in the hat", phrase_query.must_not_clauses.first.phrase) 40 | end 41 | 42 | def test_single_word_phrase 43 | parsed_query = { 44 | :query => [ 45 | { 46 | :clause => { 47 | :phrase => [{:term => "bar"}] 48 | } 49 | } 50 | ] 51 | } 52 | 53 | phrase_query = PhraseParser::QueryTransformer.new.apply(parsed_query) 54 | assert(phrase_query.should_clauses.size, 1) 55 | assert("bar", phrase_query.should_clauses.first.phrase) 56 | end 57 | 58 | def test_unexpected_clause 59 | parsed_query = { 60 | :query => [ 61 | { 62 | :clause => { 63 | :wut => [{:term => 'hi'}] 64 | } 65 | } 66 | ] 67 | } 68 | 69 | assert_raises { PhraseParser::QueryTransformer.new.apply(parsed_query) } 70 | end 71 | end 72 | -------------------------------------------------------------------------------- /tests/term_parser_tests.rb: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | require 'minitest/autorun' 3 | require_relative '../term_parser' 4 | 5 | class TermParserTests < Minitest::Test 6 | def test_single_term 7 | tree = TermParser::QueryParser.new.parse('foo') 8 | assert_equal({:query => [{:term => 'foo'}]}, tree) 9 | end 10 | 11 | def test_multiple_terms 12 | tree = TermParser::QueryParser.new.parse('foo bar baz') 13 | assert_equal({:query => [{:term => 'foo'}, {:term => 'bar'}, {:term => 'baz'}]}, tree) 14 | end 15 | 16 | def test_multiple_spaces_between_terms 17 | tree = TermParser::QueryParser.new.parse('foo bar') 18 | assert_equal({:query => [{:term => 'foo'}, {:term => 'bar'}]}, tree) 19 | end 20 | 21 | def test_non_ascii_characters 22 | tree = TermParser::QueryParser.new.parse('føé ba∑') 23 | assert_equal({:query => [{:term => 'føé'}, {:term => 'ba∑'}]}, tree) 24 | end 25 | 26 | def test_quotation_marks 27 | tree = TermParser::QueryParser.new.parse('fo"o') 28 | assert_equal({:query => [{:term => 'fo"o'}]}, tree) 29 | end 30 | end 31 | -------------------------------------------------------------------------------- /tests/term_transformer_tests.rb: -------------------------------------------------------------------------------- 1 | require 'minitest/autorun' 2 | require_relative '../term_parser' 3 | 4 | class TermTransformerTests < Minitest::Test 5 | def test_single_term 6 | parsed_query = {:query => [{:term => 'foo'}]} 7 | term_query = TermParser::QueryTransformer.new.apply(parsed_query) 8 | assert_equal(['foo'], term_query.terms) 9 | end 10 | 11 | def test_multiple_terms 12 | parsed_query = {:query => [{:term => 'foo'}, {:term => 'bar'}, {:term => 'baz'}]} 13 | term_query = TermParser::QueryTransformer.new.apply(parsed_query) 14 | assert_equal(['foo', 'bar', 'baz'], term_query.terms) 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /tutorial/boolean-term-clause.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | - 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | + 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | term 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /tutorial/decade.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 1 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 9 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 2 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 0 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | [0-9] 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 0 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | s 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | -------------------------------------------------------------------------------- /tutorial/heuristic-query.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | - 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | + 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | decade 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | term 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | " 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | term 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | " 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /tutorial/layout.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Build a query parser (using Ruby, Parslet, and Elasticsearch) 7 | 353 | 354 | 355 |
{{CONTENT}}
356 | 365 | 366 | 367 | -------------------------------------------------------------------------------- /tutorial/phrase-query.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | - 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | + 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | term 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | " 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | term 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | " 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | -------------------------------------------------------------------------------- /tutorial/railroad-diagrams/boolean_term_parser.js: -------------------------------------------------------------------------------- 1 | Diagram( 2 | OneOrMore( 3 | Sequence( 4 | Optional( 5 | Choice(0, 6 | Terminal('-'), 7 | Terminal('+') 8 | ), 9 | 'skip'), 10 | NonTerminal('term') 11 | ) 12 | ) 13 | ) 14 | -------------------------------------------------------------------------------- /tutorial/railroad-diagrams/decade.js: -------------------------------------------------------------------------------- 1 | Diagram( 2 | Sequence( 3 | Choice(0, 4 | Sequence( 5 | Terminal('1'), 6 | Terminal('9') 7 | ), 8 | Sequence( 9 | Terminal('2'), 10 | Terminal('0') 11 | ) 12 | ), 13 | Terminal('[0-9]'), 14 | Terminal('0'), 15 | Optional(Terminal('s')) 16 | ) 17 | ) 18 | -------------------------------------------------------------------------------- /tutorial/railroad-diagrams/heuristic_parser.js: -------------------------------------------------------------------------------- 1 | Diagram( 2 | OneOrMore( 3 | Sequence( 4 | Optional( 5 | Choice(0, 6 | Terminal('-'), 7 | Terminal('+') 8 | ), 9 | 'skip'), 10 | Choice(0, 11 | NonTerminal('decade'), 12 | NonTerminal('term'), 13 | Sequence( 14 | Terminal('"'), 15 | OneOrMore( 16 | NonTerminal('term') 17 | ), 18 | Terminal('"') 19 | ) 20 | ) 21 | ) 22 | ) 23 | ) 24 | -------------------------------------------------------------------------------- /tutorial/railroad-diagrams/phrase_parser.js: -------------------------------------------------------------------------------- 1 | Diagram( 2 | OneOrMore( 3 | Sequence( 4 | Optional( 5 | Choice(0, 6 | Terminal('-'), 7 | Terminal('+') 8 | ), 9 | 'skip'), 10 | Choice(0, 11 | NonTerminal('term'), 12 | Sequence( 13 | Terminal('"'), 14 | OneOrMore( 15 | NonTerminal('term') 16 | ), 17 | Terminal('"') 18 | ) 19 | ) 20 | ) 21 | ) 22 | ) 23 | -------------------------------------------------------------------------------- /tutorial/safety-vs-power.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /tutorial/term-query.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | term 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | query 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /tutorial/term.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | alphanumeric 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | term 21 | 22 | 23 | 24 | 25 | 26 | 27 | --------------------------------------------------------------------------------