Commit Graph

616 Commits

Author SHA1 Message Date
Simon Willnauer fa16969360 Cleanup comments and class names s/ElasticSearch/Elasticsearch
* Clean up s/ElasticSearch/Elasticsearch on docs/*
 * Clean up s/ElasticSearch/Elasticsearch on src/* bin/* & pom.xml
 * Clean up s/ElasticSearch/Elasticsearch on NOTICE.txt and README.textile

Closes #4634
2014-01-07 11:21:51 +01:00
Adrien Grand 4271d573d6 Page-based cache recycling.
Refactor cache recycling so that it only caches large arrays (pages) that can
later be used to build more complex data-structures such as hash tables.

 - QueueRecycler now takes a limit like other non-trivial recyclers.
 - New PageCacheRecycler (inspired of CacheRecycler) has the ability to cache
   byte[], int[], long[], double[] or Object[] arrays using a fixed amount of
   memory (either globally or per-thread depending on the Recycler impl, eg.
   queue is global while thread_local is per-thread).
 - Paged arrays in o.e.common.util can now optionally take a PageCacheRecycler
   to reuse existing pages.
 - All aggregators' data-structures now use PageCacheRecycler:
   - for all arrays (counts, mins, maxes, ...)
   - LongHash can now take a PageCacheRecycler
   - there is a new BytesRefHash (inspired from Lucene but quite different,
     still; for instance it cheats on BytesRef comparisons by using Unsafe)
     that also takes a PageCacheRecycler

Close #4557
2014-01-06 19:02:00 +01:00
Simon Willnauer e7a84d744a Add ability to run certain packages with assertions disabled
Test can be run with `-Dtests.assertion.disabled=org.elasticsearch`
to run the tests without assertions to make sure assertions
don't hide any assignements etc. that introduce bugs in production.
2013-12-30 19:36:02 +01:00
David Pilato b29f89f7f9 We run PluginManagerTests using only node client.
We also add some debug logs and fix `tests.network` (setting it to true was not working from jenkins)
2013-12-30 15:40:52 +01:00
David Pilato 7694f0b7a0 Increase MaxPermSize to 128m for tests 2013-12-30 09:56:47 +01:00
Simon Willnauer 11c4218566 Start Test nodes sometimes without mock modules
We are mocking out some functionality to add assertions etc. or
randomize store types. We should randomly run with our defaults to make
sure we don't hide any potential problems.
2013-12-29 00:50:10 +01:00
Luca Cavanna 63cbc84393 removed rest-spec submodule and prepared project for same files added directly to the codebase (no submodule) within rest-api-spec
(temporarily disabled FileUtilsTests & REST tests as there's temporarily no rest-spec dir)

Relates to #4540 #4376
2013-12-27 20:36:12 +01:00
Shay Banon e5f52ce778 update to netty 3.9.0 2013-12-23 20:06:45 +01:00
Luca Cavanna d97a00d4a7 added REST test suites runner
The REST layer can now be tested through tests that are shared between all the elasticsearch official clients.
The tests are based on REST specification that can be found on the elasticsearch-rest-api-spec project and consist of YAML files that describe the operations to be executed and the obtained results that need to be tested.

REST tests can be executed through the ElasticsearchRestTests class, which relies on the rest-spec git submodule that contains the rest spec and tests pulled from the elasticsearch-rest-spec-api project. The rest-spec submodule gets automatically initialized and updated through maven (generate-test-resources phase).

The REST runner and the needed classes are distributed within the test artifact.

The following are the options supported by the REST tests runner:

- tests.rest[true|false|host:port]: determines whether the REST tests need to be run and if so whether to rely on an external cluster (providing host and port) or fire a test cluster (default)
- tests.rest.suite: comma separated paths of the test suites to be run (by default loaded from /rest-spec/test classpath). it is possible to run only a subset of the tests providing a sub-folder or even a single yaml file (the default /rest-spec/test prefix is optional when files are loaded from classpath) e.g. -Dtests.rest.suite=index,get,create/10_with_id
- tests.rest.spec: REST spec path (default /rest-spec/api from classpath)
- tests.iters: runs multiple iterations
- tests.seed: seed to base the random behaviours on
- tests.appendseed[true|false]: enables adding the seed to each test section's description (default false)
- tests.cluster_seed: seed used to create the test cluster (if enabled)

Closes #4469
2013-12-17 15:36:16 +01:00
Simon Willnauer 8f85d63b67 Enable incremental compilation using a workaround for the maven-compiler-plugin 3.1 bug 2013-12-14 21:56:01 +01:00
Shay Banon 59d85bc22a upgrade to Jackson 2.3.0 2013-12-14 00:53:52 +01:00
Alexander Reelsen 81e13a870b Packaging: Ensure setting of sysctl vm.max_map_count
In order to be sure that memory mapped lucene directories are working
one can configure the kernel about how many memory mapped areas
a process may have. This setting ensure for the debian and redhat initscripts
as well as the systemd startup, that this setting is set high enough.

Closes #4397
2013-12-11 09:19:22 +01:00
Simon Willnauer 2b42a0f94a Override DefaultExceptionHandler to filter out certain exceptions
We have the situation that some tests fail since they don't handle
EsRejectedExecutionException which gets thrown when a node shuts
down. That is ok to ignore this exception and not fail.
We also suffer from OOMs that can't create native threads but don't
get threaddumps for those failures. This patch prints the thread
stacks once we catch a OOM which can' create native threads.
2013-12-04 14:18:52 +00:00
mrsolo 3494ac252e removing test.jvm.argline declaration
<properties> declaration was overwriting environment setting.
2013-12-02 11:44:51 -08:00
Simon Willnauer 2c8ee3fbbe Moving to 1.0.0RC1 snap 2013-12-02 17:10:07 +01:00
Kevin Kluge 296cfbe390 release [1.0.0.Beta2] 2013-12-02 15:45:30 +00:00
David Pilato fa762f09fa OOM when building with java6
The maven-compiler-plugin upgrade from 2.3.2 to 3.1 (see #4279) could cause out of memory issue when building the project with Maven and JDK6 and default memory settings (no `MAVEN_OPTS`).

This issue does not appear with JDK7.
2013-11-28 18:22:29 +01:00
David Pilato baaa1a6aa2 Upgrade Maven Surefire Plugin to 2.16
Closes #4275.
2013-11-28 14:56:51 +01:00
David Pilato 90c3fce4fe Upgrade Maven Source Plugin to 2.2.1
Closes #4276.
2013-11-28 14:56:34 +01:00
David Pilato 975c43f6d5 Upgrade RPM Maven Plugin to 2.1-alpha-3
Closes #4282.
2013-11-28 14:56:20 +01:00
David Pilato d18f0a28d9 Upgrade Maven Resources Plugin to 2.6
Closes #4280.
2013-11-28 14:56:07 +01:00
David Pilato fa0a5e5844 Upgrade Maven Jar Plugin to 2.4
Closes #4281.
2013-11-28 14:55:53 +01:00
David Pilato 2b32121e34 Upgrade Maven Eclipse Plugin to 2.9
Closes #4277.
2013-11-28 14:55:40 +01:00
David Pilato eac602ec70 Upgrade Maven Dependency Plugin to 2.8
Closes #4274.
2013-11-28 14:52:58 +01:00
David Pilato b1c62b02b0 Upgrade Maven Compiler Plugin to 3.1
Closes #4279.
2013-11-28 14:52:32 +01:00
David Pilato 79d92dffa6 Upgrade Maven Assembly Plugin to 2.4
Closes #4278.
2013-11-28 14:49:51 +01:00
David Pilato 5ec0bf32d6 Remove randomizedtesting-runner explicit dependency
Was added by mistake with #4266
2013-11-28 12:07:21 +01:00
David Pilato a9655ba812 Update to shade plugin 2.2 to shade test artifact as well
When we want to use test artifact in other projects, dependencies
are not shaded as for core artifact.

Issue opened in maven shade project: [MSHADE-158](http://jira.codehaus.org/browse/MSHADE-158)

When using it in other projects, you basically need to change your `pom.xml` file:

```xml
<dependency>
    <groupId>org.elasticsearch</groupId>
    <artifactId>elasticsearch</artifactId>
    <version>${elasticsearch.version}</version>
    <type>test-jar</type>
    <scope>test</scope>
</dependency>
```

You can also define some properties:

```xml
<properties>
    <tests.jvms>1</tests.jvms>
    <tests.shuffle>true</tests.shuffle>
    <tests.output>onerror</tests.output>
    <tests.client.ratio></tests.client.ratio>
    <es.logger.level>INFO</es.logger.level>
</properties>
```

Closes #4266
2013-11-28 10:54:48 +01:00
Simon Willnauer 5f7146aab8 Run tests with reduced stack size as we run in production 2013-11-26 11:16:02 +01:00
Simon Willnauer cf3ba7c51c Only use -Dtests.jvm.argline instead of numbered options 2013-11-26 11:11:19 +01:00
Simon Willnauer 46ab6a1533 Include JVM Arg line in reproduce line 2013-11-25 14:35:34 +01:00
Simon Willnauer 8e17d636ef Upgrade to Lucene 4.6
This commit upgrades to Lucene 4.6 and contains the following improvements:

 * Remove XIndexWriter in favor of the fixed IndexWriter
 * Removes patched XLuceneConstantScoreQuery
 * Now uses Lucene passage formatters contributed from Elasticsearch in PostingsHighlighter
 * Upgrades to Lucene46 Codec from Lucene45 Codec
 * Fixes problem in CommonTermsQueryParser where close was never called.

Closes #4241
2013-11-24 21:08:38 +01:00
Simon Willnauer eb55458e44 Upgrade RandomizedRunner Maven Plugin to 2.0.14 2013-11-22 15:00:12 +01:00
Simon Willnauer a949a8056b Upgrade to forbiddenapis 1.4 2013-11-22 08:01:30 +01:00
Simon Willnauer 00562d3a6f allow passing JVM args via env variables if not defined via the cmd 2013-11-21 17:58:43 +01:00
Simon Willnauer 02522dac06 Allow passing additional parameters to the test JVM like GC settings etc. 2013-11-21 17:39:11 +01:00
colings86 76c5f53dfa Changed pom to allow import and running from eclipse
Currently when importing projects into eclipse you need to run 'mvn
eclipse:eclipse' on the command line to generate the poject files. This
means that when the pom changes you need to re-run the command on the
command line to reflect those changes in the project in eclipse.  This
commit allows the developer to import the project as an existing maven
project (can be shared using git after import) and then allows the
application to be run inside eclipse using the .launch file in
/dev-tools enabling easy debugging of the application within eclipse
without requiring a maven build.
2013-11-21 10:56:52 +01:00
Simon Willnauer c48c8fd974 Include inner classes in the test package as well 2013-11-14 13:49:37 +01:00
Simon Willnauer 16ee742682 Cleanup test framework in order to release it as a jar file
This commit adds javadocs and removed unused methods from central
classes like ElasticsearchIntegrationTest. It also changes visibility
of many methods and classes that are only needed inside the test infrastructure.
2013-11-12 11:54:55 +01:00
Martijn van Groningen 9fdcb0ad05 Upgraded to hppc version 0.5.3 2013-11-11 14:27:52 +01:00
Shay Banon b17732ea56 upgrade to Netty 3.8.0 2013-11-09 15:41:24 +01:00
Simon Willnauer 985916038e Just filter test jar and not the main jar file 2013-11-08 23:14:56 +01:00
Simon Willnauer a824f69d21 Package test-framework as individual jar
This commit causes all classes under 'org.elasticsearch.test.*'
to be included in a 'elasticsearch-${version}-test.jar' that can be
inclued by 3rd party projects or plugins via:

```
 <dependency>
    <groupId>org.elasticsearch</groupId>
    <artifactId>elasticsearch</artifactId>
    <version>${elasticsearch.version}</version>
    <type>test-jar</type>
    <scope>test</scope>
 </dependency>
```
2013-11-08 15:08:31 +01:00
Simon Willnauer c946a69e28 Set MaxDirectMemorySize for tests to have consistent upper bounds 2013-11-07 09:44:19 +01:00
Simon Willnauer e1b6988886 move to [1.0.0.Beta2] SNAP 2013-11-06 16:19:50 +01:00
Simon Willnauer 77bc5d5ecf release [1.0.0.Beta1] 2013-11-06 15:32:43 +01:00
Shay Banon 75eda6e957 upgrade randomized testing to 2.0.12 2013-10-31 10:02:03 +01:00
Simon Willnauer 3a34aa735e Upgrade to Lucene 4.5.1 2013-10-24 18:37:44 +02:00
Simon Willnauer 0eea6e8183 Enable Random TransportClients in tests 2013-10-10 13:23:02 +02:00
Adrien Grand 6b02611971 Update Lucene to version 4.5.0. 2013-10-08 15:44:03 +02:00
Martijn van Groningen 088e05b368 Migrate from Trove to Hppc. 2013-10-03 23:10:57 +02:00
Simon Willnauer 8f087e802d Print Java Version during Validate 2013-09-27 14:39:07 +02:00
Simon Willnauer 5a365795ec Added support for dynamic transport client ratio in tests.
Currently tests only run with node clients but eventually we want to
run all tests with randomly choosen node / transport clients. To enable
this during development and on test servers as a transition phase this
commit adds the ability to allow a fraction of the clients used in
tests to be transport clients. By default this is still disabled.
To enable transport clients in tests pass '-Dtests.client.ratio=[0..1]'
where '1.0' will force transport clients and '0.0' completely disables
them. If an empty string is passed the ratio is chosen at random for
each test.
2013-09-22 22:25:30 +02:00
Simon Willnauer cabbf7805b Make TestCluster based integration tests more repoducible
While testing an async system providing reproducible tests that
use randomized components is a hard task we should at least try to
reestablish the enviroment of a failing test as much as possible.
This commit allows to re-establish the shared 'TestCluster' by
resetting the cluster to a predefined shared state before each test.

Before this commit a tests that is executed in isolation was likely
using a entirely different node enviroment as the failing test since
the 'TestCluster' kept intermediate nodes started by other tests around.
2013-09-17 23:07:29 +02:00
Shay Banon e110d53b0c change default number of test jvms to 1
the auto default can cause a lot of pressure on a machine when running the tests (each process actually runs a multi node cluster)
2013-09-17 21:30:27 +02:00
Costin Leau dcc45070bd Merge pull request #3702 from costin/master
add elasticsearch as a service for Windows platforms
2013-09-17 05:16:29 -07:00
Costin Leau 08bf131899 rework script to handle path with spaces
use service id for pid name
disable filtering on *.exe (caused corruption)
rename exe names and add more options to .bat
start/stop operations are now supported (and expected to be called) by service.bat
add more variables from the env to customize default behavior prior to installing the service
add manager option
fixes regarding batch flow
specify service id in description
minor readability improvement
include .exe only in ZIP archive
rename x64 service id to make it work out of the box
add elasticsearch as a service for Windows platforms
based on Apace Commons Daemon
supports both x64 and x86
2013-09-17 15:01:09 +03:00
Shay Banon ae0489266e Add `node.mode` with `local` or `network`
Compared to setting node.local to true, would be nicer to support node.mode with values of local or network.

Note, node.local is still supported.

closes #3713
2013-09-17 00:34:10 +02:00
Shay Banon 88173d762a upgrade to jackson 2.2.3 2013-09-16 15:38:47 +02:00
Shay Banon 31097691af upgrade to netty 3.7.0 2013-09-16 15:05:28 +02:00
Shay Banon cd90382964 upgrade to google guava v 15 2013-09-16 09:14:00 +02:00
Simon Willnauer 0e936c99e3 Add -Dtests.integration support to pom.xml 2013-09-11 22:16:43 +02:00
Simon Willnauer e68303d6a6 Allow test output to be configurable via CMD 2013-09-04 12:46:43 +02:00
Adrien Grand 5b6be0c456 Use a separate build directory for Eclipse.
The fact that Maven and Eclipse share the same build directories can trigger
race conditions when both are trying to build at the same time, eg. if you run
`mvn clean test` while Eclipse is up and running: Eclipse will notice that some
class files are missing and start compiling in parallel with Maven.
2013-08-29 10:29:26 +02:00
Shay Banon f3a35ccc90 upgrade to joda 2.3 2013-08-24 00:07:57 +02:00
Boaz Leskes 9869427ef6 Allow to configure root logging level using system properties. Ex. -Des.logger.level=DEBUG . Defaults to INFO as before. 2013-08-15 14:36:00 +02:00
Simon Willnauer ba13930b32 Fix test include pattern to include *Test.class
We missed *Test.class which is not our convention but we could miss
some tests. We should better include the *Test.class tests as well.
2013-08-13 17:46:48 +02:00
Simon Willnauer 59be83f9fc Remove accidentially committed default values
`-Dtests.maxFailures` and `-Dtests.failfast` should not be enabled
by default.
2013-08-12 14:32:04 +02:00
Simon Willnauer dbed36a13f Added support for `tests.failfast` and `tests.maxiters`
This commit adds support for failing fast when running a test
case with `-Dtests.iters=N` and uses some goodness from LuceneTestCase
in a new base `AbstractRandomizedTest`. This class checks among other
things if a tests doesn't call `super.setup` / `super.tearDown` when it
should do and checks if a large static resources are not cleaned up
after the tests ie. a running node.
2013-08-12 13:18:56 +02:00
Alexander Reelsen 68b77c1ae3 Included only runtime dependencies when copying
This makes sure, that no test dependencies are placed in the distribution
2013-08-06 15:13:25 +02:00
Shay Banon 976152b23e enable sys out check + remove unused code 2013-07-26 18:57:21 +02:00
Shay Banon 70bbcb4c48 Add Git build info when we build a distribution
closes #3370
2013-07-24 20:24:23 +02:00
Simon Willnauer ed473e272d Cut over to JUnit & Randomized Runner from TestNG
For better integration with the Lucene Test Framework and the
availabilty of RandomizedRunner / Randommized Testing this commit
moves over from TestNG to JUnit.
This commit also moves relevant places over to RandomzedRunner for
reproduceability and removes copied classes from the Lucene Test
Framework.
2013-07-24 16:59:36 +02:00
Simon Willnauer 2e9851138e Upgrade to Lucene 4.4 2013-07-23 13:55:15 +02:00
Alexander Reelsen 3162f5b725 Updated maven shade plugin to version 2.1
The currently used maven shade plugin still keeps references to the
original classes in their constant pools around. This is never a problem
at runtime, but for dependency tools which try to use the constant pool
for determining dependencies will get confused (OSGI for example). This
patch simply bumps the version and will implicetely fix
fix http://jira.codehaus.org/browse/MSHADE-105

Closes #3254
Closes #3255
2013-07-04 15:57:13 +02:00
Alexander Reelsen 455bc32460 Moving forbidden-api checks to compile phase instead of test phase (fail fast) 2013-06-28 13:12:52 +02:00
Shay Banon 0114fb0f58 add running the tests in headless mode in maven 2013-06-27 23:23:13 +01:00
Adrien Grand 1954f770a1 Put Eclipse settings in the root directory.
This enforces that settings are taken into account whichever mean is used to
import the project into Eclipse (manual import, m2e, mvn eclipse:eclipse, ...).
2013-06-26 16:51:47 +02:00
Simon Willnauer a388588b1f Upgrade to Lucene 4.3.1 2013-06-18 22:15:31 +02:00
Shay Banon f155525cad upgrade jackson to 2.2.2, netty to 3.6.6 2013-06-11 20:36:08 +02:00
Alexander Reelsen a5f9173e14 Making deb installable by being lintian compatible
According to #2515 the ubuntu software center does not allow to install
debian packages which are not lintian compatible

I worked on the package and made it lintian compatible by doing

* Ignoring errors about arch dependent binaries as we will not split
  this package. The arch dependent libraries are used correctly.
* Added a copyright file pointing to the apache license in debian

Closes #2515
Closes #2320
2013-06-07 13:53:14 +02:00
Alexander Reelsen 183bb76371 Ensure config files are not overwritten in RPM upgrade
In order to ensure that configuration files do not get overwritten when
upgrading an RPM, it is not sufficient to mark them as configuration. You
have to use the 'noreplace' parameter to make sure, they are never
overwritten. Added this parameter for the /etc/elasticsearch directory
as well as the /etc/sysconfig/elasticsearch file.

In addition, the post remove script now only deletes the user in case of
a package removal (and does nothing on package upgrade).

Closes #3123
2013-05-31 16:26:10 +02:00
Adrien Grand c16a46e15c Make it easier to get started with Eclipse.
This patch makes mvn eclipse:eclipse generate additional eclipse configuration
files so that Eclipse:
 - uses Java 1.6 compliance level,
 - truncates lines after 140 chars,
 - uses 4 spaces for indentation,
 - automatically adds a license header when creating a new class file,
 - organizes imports the same way as Intellij Idea (which makes sense I guess
   since most of the code bas has been written with Intellij, this will prevent
   from having large diffs due to the fact that the order of imports has
   changed).
2013-05-30 16:48:58 +02:00
Simon Willnauer 31f0aca65d Integrate forbiddenAPI checks into Maven build.
This commit integrates the forbiddenAPI checks that checks
Java byte code against a list of "forbidden" API signatures.
The commit also contains the fixes of the current source code
that didn't pass the default API checks.

See https://code.google.com/p/forbidden-apis/ for details.

Closes #3059
2013-05-19 23:25:44 +02:00
Shay Banon 2ab72da7d6 update to joda 2.2 2013-05-11 23:37:56 +02:00
Shay Banon e09e3eb73b upgrade to mvel 2.1.5 2013-05-11 23:17:00 +02:00
Shay Banon 522ca7e889 upgrade to jackson 2.2.1 2013-05-09 18:00:23 +02:00
Simon Willnauer 2219925485 Upgrade to Lucene 4.3.0
This Lucene Release introduced a new API on DocIdSetIterator that requires each
implementation to return a `cost` upperbound as a function of the iterated documents.
This API allows for several optimizations during query execution especially in
Conjunction and Disjunction Queries with min_should_match set.

Closes #2990
2013-05-06 18:03:16 +02:00
Shay Banon 6c3bb4dcdd move to 1.0.0.Beta1 snap 2013-04-29 13:51:09 +02:00
Shay Banon cb75ce0caa release 0.90.0 GA 2013-04-29 13:41:43 +02:00
Shay Banon 80fc55a01d upgrade to netty 3.6.5 2013-04-09 09:44:49 -07:00
Shay Banon 3120457bfe move to 0.90.0.RC3 snap 2013-04-08 05:48:29 -07:00
Shay Banon 3a8cba4d50 release 0.90.0.RC2 2013-04-08 05:46:26 -07:00
Simon Willnauer eb8b38d027 Upgrade to Lucene 4.2.1 2013-04-03 12:22:39 +02:00
Alexander Reelsen 0a466352cd Add support for creating a fedora RPM package with maven
Note: This has been disabled by default and is therefore not included in a
standard build. The main reason for this is, that you need to have a RPM
binary and the rpm development packages installed, which is not the case
on many systems.

The package contains an init.d-script as well as systemd configurations.

You can build your own RPM package simply by running 'maven rpm:rpm'
2013-04-02 16:19:45 +02:00
Shay Banon ea698add72 move to 0.90.0.RC2 snap 2013-03-20 19:06:30 +01:00
Shay Banon a2f14b68e8 release 0.90.0.RC1 2013-03-20 19:05:08 +01:00
Shay Banon bea7bdde4c upgrade to guava 14.0.1 2013-03-18 23:10:14 +01:00
Simon Willnauer 11bf7a8b1a Upgrade to Lucene 4.2 2013-03-11 08:23:01 +01:00
Shay Banon 1d45edd856 upgrade to jackson 2.1.4 2013-02-28 09:10:43 +01:00
Shay Banon f02c3ec39a upgrade to guava 14.0 2013-02-27 18:31:13 +01:00
Shay Banon 31c273231a remove compress flag, as its no longer relevant 2013-02-27 18:13:48 +01:00
Shay Banon bd75b731c6 move to 0.90.0.Beta2 snap 2013-02-26 10:33:57 +01:00
Shay Banon ab3a59e0bf release 0.90.0.Beta1 2013-02-26 10:32:50 +01:00
Shay Banon 358c0e35fb upgrade to latest jackson 2013-02-25 11:15:45 +01:00
Shay Banon 7787901a2d cleanup the pom 2013-02-23 10:52:30 +01:00
Shay Banon a3096157f8 upgrade to netty 3.6.3 2013-02-22 17:20:41 +01:00
Simon Willnauer 06fc9c77ba don't exclude services otherwise es.jar doesn't include the SPI information to load XBloomPostings 2013-02-18 23:06:01 +01:00
Simon Willnauer 8db436f107 Remove backported Lucene 4 spatial code in favor of the released version in Lucene 4.1 2013-02-18 18:43:55 +01:00
Igor Motov 6890c9fa62 Move action.wait_on_mapping_change setting to pom 2013-02-06 11:48:58 -05:00
Martijn van Groningen 46dd42920c Remove scope support in query and facet dsl.
Remove support for the `scope` field in facets and `_scope` field in the nested and parent/child queries. The scope support for nested queries will be replaced by the `nested` facet option and a facet filter with a nested filter. The nested filters will now support the a `join` option. Which controls whether to perform the block join. By default this enabled, but when disabled it returns the nested documents as hits instead of the joined root document.

Search request with the current scope support.
```
curl -s -XPOST 'localhost:9200/products/_search' -d '{
    "query" : {
		"nested" : {
			"path" : "offers",
			"query" : {
				"match" : {
					"offers.color" : "blue"
				}
			},
			"_scope" : "my_scope"
		}
	},
	"facets" : {
		"size" : {
			"terms" : {
				"field" : "offers.size"
			},
			"scope" : "my_scope"
		}
	}
}'
```

The following will be functional equivalent of using the scope support:
```
curl -s -XPOST 'localhost:9200/products/_search?search_type=count' -d '{
    "query" : {
		"nested" : {
			"path" : "offers",
			"query" : {
				"match" : {
					"offers.color" : "blue"
				}
			}
		}
	},
	"facets" : {
		"size" : {
			"terms" : {
				"field" : "offers.size"
			},
			"facet_filter" : {
				"nested" : {
					"path" : "offers",
					"query" : {
						"match" : {
							"offers.color" : "blue"
						}
					},
					"join" : false
				}
			},
			"nested" : "offers"
		}
	}
}'
```

The scope support for parent/child queries will be replaced by running the child query as filter in a global facet.

Search request with the current scope support:
```
curl -s -XPOST 'localhost:9200/products/_search' -d '{
	"query" : {
		"has_child" : {
			"type" : "offer",
			"query" : {
				"match" : {
					"color" : "blue"
				}
			},
			"_scope" : "my_scope"
		}
	},
	"facets" : {
		"size" : {
			"terms" : {
				"field" : "size"
			},
			"scope" : "my_scope"
		}
	}
}'
```

The following is the functional equivalent of using the scope support with parent/child queries:
```
curl -s -XPOST 'localhost:9200/products/_search' -d '{
	"query" : {
		"has_child" : {
			"type" : "offer",
			"query" : {
				"match" : {
					"color" : "blue"
				}
			}
		}
	},
	"facets" : {
		"size" : {
			"terms" : {
				"field" : "size"
			},
			"global" : true,
			"facet_filter" : {
				"term" : {
					"color" : "blue"
				}
			}
		}
	}
}'
```

Closes #2606
2013-01-31 15:09:57 +01:00
Martijn van Groningen 98a674fc6e Added suggest api.
# Suggest feature
The suggest feature suggests similar looking terms based on a provided text by using a suggester. At the moment there the only supported suggester is `fuzzy`. The suggest feature is available since version `0.21.0`.

# Fuzzy suggester
The `fuzzy` suggester suggests terms based on edit distance. The provided suggest text is analyzed before terms are suggested. The suggested terms are provided per analyzed suggest text token. The `fuzzy` suggester doesn't take the query into account that is part of request.

# Suggest API
The suggest request part is defined along side the query part as top field in the json request.

```
curl -s -XPOST 'localhost:9200/_search' -d '{
    "query" : {
        ...
    },
    "suggest" : {
        ...
    }
}'
```

Several suggestions can be specified per request. Each suggestion is identified with an arbitary name. In the example below two suggestions are requested. The `my-suggest-1` suggestion uses the `body` field and `my-suggest-2` uses the `title` field. The `type` field is a required field and defines what suggester to use for a suggestion.

```
"suggest" : {
    "suggestions" : {
        "my-suggest-1" : {
            "type" : "fuzzy",
            "field" : "body",
            "text" : "the amsterdma meetpu"
        },
        "my-suggest-2" : {
            "type" : "fuzzy",
            "field" : "title",
            "text" : "the rottredam meetpu"
        }
    }
}
```

The below suggest response example includes the suggestions part for `my-suggest-1` and `my-suggest-2`. Each suggestion part contains a terms array, that contains all terms outputted by the analyzed suggest text. Each term object includes the term itself, the original start and end offset in the suggest text and if found an arbitary number of suggestions.

```
{
    ...
    "suggest": {
        "my-suggest-1": {
            "terms" : [
              {
                "term" : "amsterdma",
                "start_offset": 5,
                "end_offset": 14,
                "suggestions": [
                   ...
                ]
              }
              ...
            ]
        },
        "my-suggest-2" : {
          "terms" : [
            ...
          ]
        }
    }
```

Each suggestions array contains a suggestion object that includes the suggested term, its document frequency and score compared to the suggest text term. The meaning of the score depends on the used suggester. The fuzzy suggester's score is based on the edit distance.

```
"suggestions": [
    {
        "term": "amsterdam",
        "frequency": 77,
        "score": 0.8888889
    },
    ...
]
```

# Global suggest text

To avoid repitition of the suggest text, it is possible to define a global text. In the example below the suggest text is a global option and applies to the `my-suggest-1` and `my-suggest-2` suggestions.

```
"suggest" : {
    "suggestions" : {
        "text" : "the amsterdma meetpu",
        "my-suggest-1" : {
            "type" : "fuzzy",
            "field" : "title"
        },
        "my-suggest-2" : {
            "type" : "fuzzy",
            "field" : "body"
        }
    }
}
```

The suggest text can be specied as global option or as suggestion specific option. The suggest text specified on suggestion level override the suggest text on the global level.

# Other suggest example.

In the below example we request suggestions for the following suggest text: `devloping distibutd saerch engies` on the `title` field with a maximum of 3 suggestions per term inside the suggest text. Note that in this example we use the `count` search type. This isn't required, but a nice optimalization. The suggestions are gather in the `query` phase and in the case that we only care about suggestions (so no hits) we don't need to execute the `fetch` phase.

```
curl -s -XPOST 'localhost:9200/_search?search_type=count' -d '{
  "suggest" : {
      "suggestions" : {
        "my-title-suggestions" : {
          "suggester" : "fuzzy",
          "field" : "title",
          "text" : "devloping distibutd saerch engies",
          "size" : 3
        }
      }
  }
}'
```

The above request could yield the response as stated in the code example below. As you can see if we take the first suggested term of each suggest text term we get `developing distributed search engines` as result.

```
{
  ...
  "suggest": {
    "my-title-suggestions": {
      "terms": [
        {
          "term": "devloping",
          "start_offset": 0,
          "end_offset": 9,
          "suggestions": [
            {
              "term": "developing",
              "frequency": 77,
              "score": 0.8888889
            },
            {
              "term": "deloping",
              "frequency": 1,
              "score": 0.875
            },
            {
              "term": "deploying",
              "frequency": 2,
              "score": 0.7777778
            }
          ]
        },
        {
          "term": "distibutd",
          "start_offset": 10,
          "end_offset": 19,
          "suggestions": [
            {
              "term": "distributed",
              "frequency": 217,
              "score": 0.7777778
            },
            {
              "term": "disributed",
              "frequency": 1,
              "score": 0.7777778
            },
            {
              "term": "distribute",
              "frequency": 1,
              "score": 0.7777778
            }
          ]
        },
        {
          "term": "saerch",
          "start_offset": 20,
          "end_offset": 26,
          "suggestions": [
            {
              "term": "search",
              "frequency": 1038,
              "score": 0.8333333
            },
            {
              "term": "smerch",
              "frequency": 3,
              "score": 0.8333333
            },
            {
              "term": "serch",
              "frequency": 2,
              "score": 0.8
            }
          ]
        },
        {
          "term": "engies",
          "start_offset": 27,
          "end_offset": 33,
          "suggestions": [
            {
              "term": "engines",
              "frequency": 568,
              "score": 0.8333333
            },
            {
              "term": "engles",
              "frequency": 3,
              "score": 0.8333333
            },
            {
              "term": "eggies",
              "frequency": 1,
              "score": 0.8333333
            }
          ]
        }
      ]
    }
  }
  ...
}
```

# Common suggest options:
* `suggester` - The suggester implementation type. The only supported value is 'fuzzy'. This is a required option.
* `text` - The suggest text. The suggest text is a required option that needs to be set globally or per suggestion.

# Common fuzzy suggest options
* `field` - The field to fetch the candidate suggestions from. This is an required option that either needs to be set globally or per suggestion.
* `analyzer` - The analyzer to analyse the suggest text with. Defaults to the search analyzer of the suggest field.
* `size` - The maximum corrections to be returned per suggest text token.
* `sort` - Defines how suggestions should be sorted per suggest text term. Two possible value:
** `score` - Sort by sore first, then document frequency and then the term itself.
** `frequency` - Sort by document frequency first, then simlarity score and then the term itself.
* `suggest_mode` - The suggest mode controls what suggestions are included or controls for what suggest text terms, suggestions should be suggested. Three possible values can be specified:
** `missing` - Only suggest terms in the suggest text that aren't in the index. This is the default.
** `popular` - Only suggest suggestions that occur in more docs then the original suggest text term.
** `always` - Suggest any matching suggestions based on terms in the suggest text.

# Other fuzzy suggest options:
* `lowercase_terms` - Lower cases the suggest text terms after text analyzation.
* `max_edits` - The maximum edit distance candidate suggestions can have in order to be considered as a suggestion. Can only be a value between 1 and 2. Any other value result in an bad request error being thrown. Defaults to 2.
* `min_prefix` - The number of minimal prefix characters that must match in order be a candidate suggestions. Defaults to 1. Increasing this number improves spellcheck performance. Usually misspellings don't occur in the beginning of terms.
* `min_query_length` -  The minimum length a suggest text term must have in order to be included. Defaults to 4.
* `shard_size` - Sets the maximum number of suggestions to be retrieved from each individual shard. During the reduce phase only the top N suggestions are returned based on the `size` option. Defaults to the `size` option. Setting this to a value higher than the `size` can be useful in order to get a more accurate document frequency for spelling corrections at the cost of performance. Due to the fact that terms are partitioned amongst shards, the shard level document frequencies of spelling corrections may not be precise. Increasing this will make these document frequencies more precise.
* `max_inspections` - A factor that is used to multiply with the `shards_size` in order to inspect more candidate spell corrections on the shard level. Can improve accuracy at the cost of performance. Defaults to 5.
* `threshold_frequency` - The minimal threshold in number of documents a suggestion should appear in. This can be specified as an absolute number or as a relative percentage of number of documents. This can improve quality by only suggesting high frequency terms. Defaults to 0f and is not enabled. If a value higher than 1 is specified then the number cannot be fractional. The shard level document frequencies are used for this option.
* `max_query_frequency` - The maximum threshold in number of documents a sugges text token can exist in order to be included. Can be a relative percentage number (e.g 0.4) or an absolute number to represent document frequencies. If an value higher than 1 is specified then fractional can not be specified. Defaults to 0.01f. This can be used to exclude high frequency terms from being spellchecked. High frequency terms are usually spelled correctly on top of this this also improves the spellcheck performance.  The shard level document frequencies are used for this option.

 Closes #2585
2013-01-24 15:41:06 +01:00
Simon Willnauer 2880cd0172 Upgrade to Lucene 4.1
* Removed CustmoMemoryIndex in favor of MemoryIndex which as of 4.1 supports adding the same field twice
* Replaced duplicated logic in X[*]FSDirectory for rate limiting with a RateLimitedFSDirectory wrapper
* Remove hacks to find out merge context in rate limiting in favor of IOContext
* replaced Scorer#freq() return type (from float to int)
* Upgraded FVHighlighter to new 'centered' highlighting
* Fixed RobinEngine to use seperate setCommitData
2013-01-23 11:54:11 +01:00
Shay Banon 468295dc37 upgrade to netty 3.6.2 2013-01-18 12:47:13 +01:00
Shay Banon 7726a4a9dd upgrade to netty 3.6.1 2013-01-04 16:06:15 +01:00
Jilles van Gurp 2649c6c758 add plugin configuration to make m2e ignore maven dependency plugin configuration that it cannot handle 2013-01-04 08:23:30 +01:00
Shay Banon bab91bb9fd upgrade to jackson 2.1.1 2012-12-27 12:03:59 -08:00
Shay Banon d739498498 upgrade to netty 3.6.0 2012-12-27 11:55:37 -08:00
Shay Banon f17ad829ac remove snappy support
relates to #2459
2012-12-03 12:30:13 +01:00
Shay Banon b10cec1908 Upgrade to Netty 3.5.11
closes #2456
2012-12-02 22:29:49 +01:00
Simon Willnauer 479f1784e8 lucene 4: converted queryparser to lucene classic query parser 2012-11-12 13:44:32 +01:00
Shay Banon a4d0e3a0e8 lucene 4: add codes dependency 2012-11-12 13:44:31 +01:00
Igor Motov 05138bb2fb lucene 4: upgrade analyzers 2012-11-12 13:44:30 +01:00
Shay Banon 55a31f7ac5 change to lucene 4.0 dependency
upgrade has begun...
2012-11-12 13:44:30 +01:00
Shay Banon ac3501bc72 Upgrade to netty 3.5.10
closes #2399
2012-11-12 10:39:27 +01:00
Shay Banon ec64c8c907 Upgrade to Netty 3.5.9
closes #2377
2012-11-01 16:16:06 +01:00
Shay Banon c1489be816 forgot to mark 0.21.0 as snap 2012-10-22 01:55:33 +02:00
Shay Banon 6ec0071fa4 move master to be 0.21.0 Beta1 snap 2012-10-22 01:51:20 +02:00
Shay Banon fe980343be release 0.20.0.RC1 2012-10-22 01:48:09 +02:00
Shay Banon c350dcd9cf upgrade to jackson 2.1.0 2012-10-14 15:37:08 -04:00
Shay Banon c56cc6ecbe Upgrade to netty 3.5.8
closes #2299.
2012-09-29 19:24:43 -04:00
Shay Banon 81775cc763 upgrade to mvel 2.1.3 2012-09-28 10:02:52 +02:00
Chris Male 6fc0b83e07 Upgraded to Spatial4j 0.3 2012-09-20 23:55:51 +02:00
Shay Banon 2275b82549 upgrade to testng 6.8 2012-09-17 16:23:18 +02:00
Shay Banon 19fdd46c87 upgrade to log4j 1.2.17 2012-09-15 10:16:18 +02:00
Shay Banon dd970752e7 upgrade to Netty 3.5.7.Final 2012-09-07 11:12:35 +02:00
Shay Banon 162dfb7011 Upgrade to LZF 0.9.6 2012-09-06 14:55:01 +02:00
Shay Banon 82b36e5bb8 upgrade to maven surefire 2.12.3 2012-09-03 20:48:44 +02:00
Shay Banon b055b5a94c Upgrade to mvel 2.1.1, closes #2228. 2012-09-02 21:29:10 +02:00
Shay Banon 8b499dd4fd upgrade to guava 13.0.1 2012-09-02 17:52:40 +02:00
Shay Banon 6c3847b0a9 move spatial4j and jts to be optional dependencies
allowing data and client nodes to work without them, disabling shapes if needed
2012-09-01 00:05:49 +02:00
Shay Banon 377914bd07 Upgrade to netty 3.5.5, closes #2196. 2012-08-23 01:30:49 +02:00
Shay Banon a80639abf5 exclude xerces from the deps for jts, we don't need it 2012-08-20 17:48:18 +02:00
Shay Banon dbe2f53a00 Support YAML as content type 2012-08-20 17:40:19 +02:00
Shay Banon 341c53b580 Upgrade to Netty 3.5.4, closes #2180. 2012-08-16 12:15:24 -07:00
Shay Banon 980fc6ca34 add new spatial jars to deb package as well 2012-08-13 14:51:53 +02:00
Chris Male bea4346f3a Added GeoShape indexing and querying support 2012-08-13 13:44:29 +02:00
Shay Banon 53d29e5d8d Upgrade to guava 13.0 2012-08-08 20:52:09 +02:00
Shay Banon 82cfe0e8b2 upgrade to latest testng, improve console output when running test, add more options as env vars when using maven 2012-07-31 20:24:39 +02:00
Shay Banon 6e20056619 Upgrade to Netty 3.5.3, closes #2119. 2012-07-27 19:01:21 +02:00
Shay Banon 90e94ebab9 Upgrade to Lucene 3.6.1, closes #2110. 2012-07-22 13:28:39 -07:00
Shay Banon 73a34ee537 upgrade to guava 12.0.1 2012-07-14 13:02:21 +02:00
Shay Banon bfb4a29700 fix new jackson version to be properly shaded 2012-07-11 01:18:59 +02:00
Shay Banon 57e966e9d7 upgrade to jackson 2.0.4 2012-07-10 23:44:02 +02:00
Shay Banon 5f1b1c6f69 Upgrade to Netty 3.5.2, closes #2084. 2012-07-05 23:09:26 +02:00
Shay Banon 57023c8ba9 Compression: Support snappy as a compression option, closes #2081. 2012-07-04 17:14:12 +02:00
Shay Banon 1ffd68f2de Upgrade to netty 3.5.1 2012-06-28 00:51:37 +02:00
Shay Banon 2b893fe1e5 Use bloom filter when flushing (applying deletes), closes #2058. 2012-06-26 16:45:29 +02:00
Shay Banon aebd27afbd abstract compression
abstract the LZF compression into a compress package allowing for different implementation in the future
2012-06-19 04:07:11 +02:00
Shay Banon 2280915d3c upgrade to joda 2.1
with the hack of duplicating BaseDateTime to remove the volatile
2012-06-14 21:57:01 +02:00
Shay Banon 2a80e14284 .DS_Store file in .deb package, closes #2017. 2012-06-11 21:06:52 +02:00
Shay Banon 8f0bc799c6 Upgrade to latest jst166y and jsr166e
Embed the code now in our source, since jsr166e jar generation with 1.6 instead of 1.7 is complicated when doing it on its own as it relies on ThreadLocalRandom, and we have it in jsr166y
2012-06-10 00:42:54 +02:00
Shay Banon 43483b1237 upgrade to trove 3.0.3 2012-06-09 23:01:51 +02:00
Shay Banon 6c67570589 fix wrong change to version 2012-06-08 23:22:38 +02:00
Shay Banon 77e3cc1790 Upgrade to Netty 3.5.0.Final, closes #2013. 2012-06-08 23:20:45 +02:00
Shay Banon 398e8a597f Upgrade to netty 3.4.6
Contains no applicable changes to our usage, but still be on track with latest
2012-05-29 19:33:21 +02:00
Shay Banon 11a1f69257 Upgrade to Netty 3.4.5, closes #1958. 2012-05-16 21:58:34 +03:00
Shay Banon 76e1c3a017 Upgrade to guava 12.0, closes #1920. 2012-05-07 20:08:41 +03:00
Shay Banon 3556020065 Upgrade to netty 3.4.3.Final, closes #1914. 2012-05-06 19:52:00 +03:00
Shay Banon 2d26cbcde3 Upgrade to Netty 3.4.2, closes #1909. 2012-05-03 22:03:34 +03:00
Shay Banon d0ab672982 upgrade to jackson 1.9.7 2012-05-03 21:28:51 +03:00
Shay Banon eb057d4ce6 Upgrade to Netty 3.4.1.Final, closes #1878. 2012-04-21 16:03:15 +03:00
Shay Banon 62954e6d1f Upgrade to Netty 3.4.0, closes #1863. 2012-04-15 18:15:17 +03:00
Shay Banon 16cd159a38 Upgrade to Lucene 3.6, closes #1862. 2012-04-15 17:39:41 +03:00
Shay Banon 5131dc44ff upgrade to guava 11.0.2 2012-03-21 15:35:05 +02:00
Shay Banon 32e1eff05a move to 0.20.0.Beta1 snapshot 2012-03-02 11:23:24 +02:00
Shay Banon b8d583a06e release 0.19.0 2012-03-02 11:17:55 +02:00
Shay Banon 9a51179c22 upgrade to jackson 1.9.5 2012-02-26 23:06:04 +02:00
Shay Banon 7a10f18645 upgrade to latest 2.3 assembly plugin 2012-02-26 21:07:55 +02:00
Shay Banon d8123efac8 upgrade to jdeb 0.9 plugin 2012-02-26 10:06:44 +02:00
Shay Banon 2dfee54de7 upgrade to the latest assembly plugin and use artifact id (though not in distributions) 2012-02-26 10:06:18 +02:00
Shay Banon ca5f6ec0f6 move to 0.19.0.RC4 snap 2012-02-21 14:54:41 +02:00
Shay Banon aeaed0a1b0 release 0.19.0.RC3 2012-02-21 14:52:49 +02:00
Shay Banon ff3ebe4a4b upgrade to jackson 1.7.4 2012-02-17 12:50:43 +02:00
Shay Banon 5836c24b80 move to use sigar jar from maven central, which means that when using in the IDEA or running tests, sigar will not be enabled (since native files are not present), interim fix until we have a better one 2012-02-14 12:49:31 +02:00
Shay Banon bf11c19e49 move to use sigar jar from maven central, which means that when using in the IDEA or running tests, sigar will not be enabled (since native files are not present), interim fix until we have a better one 2012-02-14 12:49:15 +02:00
Shay Banon 676f115a26 update versions to 0.19.3 snap 2012-02-09 00:37:12 +02:00
Shay Banon f5676780ae release 0.19.0.RC2 2012-02-09 00:35:59 +02:00
Peter 4492b14f5f mini layout change to pom.xml 2012-02-08 08:45:40 +01:00
Peter 93134bd89e merged master 2012-02-08 08:31:41 +01:00
Shay Banon 7b3d9efe2e upgrade to netty 3.3.1 2012-02-07 20:15:55 +02:00
Shay Banon a89878ce6c move to 0.19.0.RC2 snap 2012-02-07 15:17:09 +02:00
Shay Banon b160ddbb2c release 0.19.0.RC1 2012-02-07 15:02:42 +02:00
Shay Banon 73266d1e44 upgrade to mvel 2.1.Beta8 2012-02-06 04:08:26 +02:00
Shay Banon f282081361 upgrade to latest compiled jsr166 libs 2012-01-31 21:00:58 +02:00
Shay Banon 62809bb62a Upgrade to netty 3.3.0 2012-01-19 23:32:59 +02:00
Shay Banon 002c8a6599 upgrade to 11.0.1 guava 2012-01-11 15:39:09 +02:00
Shay Banon 3d51553cf2 Move phonetic token filter to a plugin, closes #1594. 2012-01-07 23:18:30 +02:00
Shay Banon a18021c778 Filter cache to have just weighted (node) and none, and index query parser cache to be size based, closes #1590. 2012-01-05 20:44:09 +02:00
Shay Banon a488424404 Analysis: Add phonetic encodder called `bm` or `beider_morse`, closes #1552. 2011-12-21 03:53:44 +02:00
Shay Banon e827c56be4 move to 1.9.3 jackson 2011-12-19 13:51:50 +02:00
Shay Banon 367a608707 remove jline from distribution to simplify it (no longer painting log levels though...) 2011-12-16 15:36:22 +02:00
Shay Banon 41a9dc1e6d make sigar optional 2011-12-13 19:03:32 +02:00
Shay Banon 16c2c6b2c3 fix deb to properly copy over sigar 2011-12-08 13:40:09 +02:00
Peter 6d0b94b81b improved deb packaging and bound assembly:single to package 2011-12-08 13:22:09 +02:00
Peter bccf0b193e moving debian package to maven 2011-12-08 13:22:09 +02:00
Peter 17e8b7f40c improved deb packaging and bound assembly:single to package 2011-12-08 12:05:05 +01:00
Peter 3c574ba398 moving debian package to maven 2011-12-08 10:31:53 +01:00
Shay Banon 6632f8cb56 upgrade to trove 3.0.2 2011-12-07 19:42:07 +02:00
Shay Banon c1b86f5786 upgrade to guava 10.0.1 and fix assembly 2011-12-06 21:09:28 +02:00
Shay Banon f190ec4396 move some deps from provided to compile with optional set to true 2011-12-06 15:43:59 +02:00
Shay Banon 2bcc14a6ea increase mem allocated for tests, add ability to run local tests 2011-12-06 15:15:14 +02:00
Shay Banon c6d5672a17 fix to provided scope from runtime since we need to compile with it 2011-12-06 13:52:40 +02:00
Shay Banon 19d80a7f1b assemblies 2011-12-06 13:41:49 +02:00
Shay Banon 6a71eab51f finalize structure, tests pass 2011-12-06 02:43:17 +02:00
Shay Banon fa782b1210 initial pom 2011-12-06 01:05:44 +02:00