Commit Graph

3621 Commits

Author SHA1 Message Date
Costin Leau a19b77484e Add plugin class space isolation
Each plugin is now loaded in its own classloader to prevent class
conflicts when loading different versions of the same library. It
 is enabled by default and is configurable through
 `plugins.isolation` settings .Additionally, each plugin can
change its own isolation through the `isolation` property in
`es-plugin.properties`- if not specified, the global setting in
ES applies.

Closes #5261
2014-02-28 15:05:20 +02:00
javanna 91f5be6816 [TEST] more assertAcked in SharedClusterShapshotRestoreTests 2014-02-28 12:54:10 +01:00
Martijn van Groningen 03f6f523b0 Added more trace and debug logging 2014-02-28 11:19:18 +01:00
Simon Willnauer a1f66daea9 Move ensureEstimatedStats() after index wiping to ensure everything is cleaned up once the index is removed 2014-02-27 23:11:43 +01:00
Adrien Grand a9592e5523 Add assertion to not forget to replace reflection with the new FilterAtomicReader.unwrap. 2014-02-27 22:41:40 +01:00
Simon Willnauer 86bfa6ecdc Improve error reporting on breaker stats assertion 2014-02-27 22:39:39 +01:00
Lee Hinman 550c407994 Remove trace logging from testBreakerWithRandomExceptions() 2014-02-27 13:24:11 -07:00
Lee Hinman e53a43800e Add `explain` flag support to the reroute API
By specifying the `explain` flag, an explanation for the reason a
command can or cannot be executed is returned. No allocation commands
are actually performed.

Returns a response similar to:

{
  "state": {...cluster state...},
  "acknowledged": true,
  "explanations" : [ {
    "command" : "cancel",
      "parameters" : {
        "index" : "decide",
        "shard" : 0,
        "node" : "IvpoKRdtRiGrQ_WKtt4_4w",
        "allow_primary" : false
      },
      "decisions" : [ {
        "decider" : "cancel_allocation_command",
        "decision" : "YES",
        "explanation" : "..."
        } ]
     }, {
      "command" : "move",
      "parameters" : {
        "index" : "decide",
        "shard" : 0,
        "from_node" : "IvpoKRdtRiGrQ_WKtt4_4w",
        "to_node" : "IvpoKRdtRiGrQ_WKtt4_4w"
       },
       "decisions" : [ {
         "decider" : "same_shard",
         "decision" : "NO",
         "explanation" : "shard cannot be allocated on same node [IvpoKRdtRiGrQ_WKtt4_4w] it already exists on"
       },
       etc
       ]
  }]
}

also removes AllocationExplanation from cluster state

Closes #2483
Closes #5169
2014-02-27 09:48:51 -07:00
Simon Willnauer fe9de7fba2 Use FieldMapper to create the low level term queries in CommonTermQuery
Closes #5258
2014-02-27 14:50:42 +01:00
Adrien Grand 3839454168 Add tracking of allocated arrays.
The BigArrays utility class is useful to generate arrays of various sizes: when
small, arrays will be allocated directly on the heap while larger arrays are
going to be paged and to recycle pages through PageCacheRecycler. We already
have tracking for pages but this is not triggered very often since it only
happens on large amounts of data while our tests work on small amounts of data
in order to be fast.

Tracking arrays directly helps make sure that we never forget to release them.

This pull request also improves testing by:

 - putting random content in the arrays upon release: this makes sure that
   consumers don't use these arrays anymore when they are released as their
   content may be subject to use for another purpose since pages are recycled

 - putting random content in the arrays upon creation and resize when
   `clearOnResize` is `false`.

The major difference with `master` is that the `BigArrays` class is now
instanciable, injected via Guice and usually available through the
`SearchContext`. This way, it can be mocked for tests.
2014-02-27 14:01:12 +01:00
Martijn van Groningen d167a0139a estimator#afterLoad should be invoked once only per reader.
It was being invoked once per reader and parent type combination resulting in more memory being reported to the circuit breaker than actually being used in field data.
2014-02-27 13:26:54 +01:00
Simon Willnauer aacc169007 Add RamUsageEstimator assertion to ElasticsearchIntegrationTest 2014-02-27 11:28:27 +01:00
Lee Hinman 9052838656 Enable trace logging for RandomExceptionCircuitBreakerTests.testBreakerWithRandomExceptions 2014-02-26 15:53:53 -07:00
Adrien Grand e1634f66bb Improve `arc` geo-distance accuracy.
Close #5192
2014-02-26 22:21:10 +01:00
Simon Willnauer 9160516b28 Expose `filler_token` via ShingleTokenFilterFactory
Lucene 4.7 supports a setter for the `filler_token` that is
inserted if there are gaps in the token stream. This change exposes
this setting.

Closes #4307
2014-02-26 22:21:10 +01:00
Simon Willnauer 30d7b8de2f Upgrade to Lucene 4.7
Closes #5104
Closes #5129
Closes #3757
2014-02-26 22:21:10 +01:00
Martijn van Groningen f488dce18f Moved AbstractHash, BytesRefHash and LongHash to o.e.common.util 2014-02-26 20:33:59 +01:00
Martijn van Groningen 53d5933c15 Added missing licence header. 2014-02-26 20:16:14 +01:00
Martijn van Groningen 0e780b7e99 Migrated p/c queries from id cache to field data. Changed p/c queries to use paging data structures (BytesRefHash, BigFloatArray, BigIntArray) instead of hppc maps / sets.
Also removed the id cache.

Closes #4930
2014-02-26 19:46:05 +01:00
Lee Hinman 5429019920 refactor SimpleQueryParser settings into separate class, add "lenient" option
Fixes #5011
2014-02-26 10:40:34 -07:00
javanna e967400522 Expose delete by query shard failures follow-up
- Removed if conditions on index name and shard_id
- Added REST test
2014-02-26 13:14:52 +01:00
Kevin 850b9d4aab Add failures reason to delete by query response
Closes #5093
2014-02-26 13:14:52 +01:00
Dawid Weiss bdced9c772 Class name typo. 2014-02-26 09:54:55 +01:00
Luca Cavanna c58c9cd352 Refactored TransportIndexReplicationOperationAction to be able to expose the shard id related to a shard failure
The `ShardOperationFailedException` is now created within `TransportIndexReplicationAction` passing in the current shard id as a constructor argument.
Also replaced `AtomicReferenceArray<Object>` with `AtomicReferenceArray<ShardActionResult>`, where `ShardActionResult` wraps the `ShardResponse` or the failure, containing all the needed info.
2014-02-25 17:29:12 +01:00
Dawid Weiss ad547eb7fb Remove nanoTime in global cluster randomization in favor of deriving the
seed from the main master seed. Removed shared cluster's seed entirely.

The problem here is that if you don't give cluster's seed then test times
fluctuate oddly, even for a fixed -Dtests.seed=... This shouldn't be the
case -- ideally, the test ran with the same master seed should reproduce
pretty much with the same execution time (and internal logic, obviously).

From the code point of view "global" variables are indeed a problem
because JUnit has no notion of before-suite hooks. And RandomizedRunner
doesn't support context accesses in static class initializers (this is
intentional because there is no way to determine when such initializers
will be executed). A workaround is to move such static global variables to
lazily-initialized methods and invoke them (once) in @BeforeClass hooks.
2014-02-25 16:51:55 +01:00
Shay Banon 83ae1bd55e remove thread local recycler
the thread local recycler requires obtain and recycle to be called on the same thread, while other recyclers do not. Also, it can create heavy recycle usage since it depends on the threads that its being used on. The concurrent / pinned thread base one is by far better than the pure thread local (and is the default) one since it more easily bounds the elements recycled, while still allowing to mix obtain and recycle across threads.

We will end up using the paged recyclers more and more, for example, in our networking output buffer, where obtaining will happen on one thread, while recycling can potentially occur on another thread (the callback thread). Since the limit of binding to a thread of the 2 calls is not really needed, and our best implementation supports going cross threads, there is no real need to impose this restriction.
2014-02-25 14:59:41 +01:00
Simon Willnauer 46fe348b8b Add coming 0.90.12 version to the constants 2014-02-25 10:35:01 +01:00
Simon Willnauer 4a48b93cf5 Implement BlendedTermQuery#extractTerms to support highlighing.
some of the highlighters require term extraction to be implemented in
order to work. BlendedTermQuery doesn't implement the trivial extraction.

Closes #5246
2014-02-25 10:13:08 +01:00
Holger Hoffstätte bac09e2926 Recycler: better lifecycle control for pooled instances (#5214)
- introduce additional destroy() callback that allows better control
over internals of recycled data
- introduced AbstractRecyclerC as superclass for Recycler factories
(Adrien) with empty destroy() by default
- added tests for destroy()
- cleaned up Recycler tests (reduce copy&paste)
2014-02-25 08:49:13 +01:00
javanna 16e350b266 Made SearchContextHighlight.Field class immutable to prevent from erroneously updating it, as it doesn't necessarily map to a single field
A Field instance can map to multiple actual fields when using wildcard expressions. Each actual field should use the proper highlighter depending on the available data structure (e.g. term_vectors), while we currently select the highlighter for the first field and we keep using the same for all the fields that match the wildcard expression.

Modified also how the PercolateContext sets the forceSource option, in a global manner now rather than per field.

Closes #5175
2014-02-25 00:17:01 +01:00
Simon Willnauer 92f132aede Need use ensureYellow() b/c get mapping request checks on actual shard instead of master node 2014-02-24 20:58:44 +01:00
Martijn van Groningen 8c3fa0551f Need use ensureYellow() b/c get mapping request checks the mapping on the master node 2014-02-24 17:49:45 +01:00
Martijn van Groningen 7064056d13 Added TransportGetFieldMappingsIndexAction that uses TransportSingleCustomOperationAction as base class, with the goal to reuse common logic (like: retry on failures, shard picking, connecting to nodes) 2014-02-24 15:54:24 +01:00
Martijn van Groningen d63ab4bd05 [TEST] Added get field mapping test variant that tests with a cluster that has a master only node. 2014-02-24 14:49:22 +01:00
Boaz Leskes 3e10810a8e Change GetFieldMapping API to broadcast requests to nodes hosting the relevant indices.
This is due to the fact that have to have mappers in order to return the response.

Closes #5177
2014-02-24 14:49:22 +01:00
David Pilato ad8a482d19 NPE in PluginsService when starting elasticsearch with a wrong user
When starting elasticsearch with a wrong linux user, it could generate a `NullPointerException` when `PluginsService` tries to list available plugins in `./plugins` dir.

To reproduce:

* create a plugins directory with `rwx` rights for root user only
* launch elasticsearch from another account (elasticsearch for example)

It was supposed to be fixed with #4186, but sadly it's not :-(

Closes #5195.
2014-02-24 11:47:13 +01:00
Igor Motov 7209f9f40b Open correct (renamed) index on restore
Closes #5212
2014-02-22 19:05:36 -05:00
Igor Motov dab1f76e03 Restore process should replace the mapping and settings if index already exists
Closes #5210
2014-02-22 18:28:19 -05:00
Luca Cavanna 4e6610a798 Fixed multi term queries support in postings highlighter for non top-level queries
In #4052 we added support for highlighting multi term queries using the postings highlighter. That worked only for top-level queries though, and not for multi term queries that are nested for instance within a bool query, or filtered query, or a constant score query.

The way we make this work is by walking the query structure and temporarily overriding the query rewrite method with a method that allows for multi terms extraction.

Closes #5102
2014-02-21 21:43:40 +01:00
javanna e913b6626f Fixed field names returned when using wildcard expression to specify fields to highlight
Closes #5221
2014-02-21 18:56:35 +01:00
javanna d94b25278a Fixed per-field forceSource highlighting option
Closes #5220
2014-02-21 17:46:32 +01:00
uboness 164f7b981e Fixed an issue where and IndexOutOfBoundsException was thrown when a date_/histogram aggregation was defined on unmapped field and also had a sub aggregation. The root cause there was that in such case, the estimated bucket count was 0, and the code was not designed to handle that well.
Closes #5179
2014-02-21 02:51:46 +01:00
Benjamin Devèze 57fcd761f2 Fix possible exception in toCamelCase method 2014-02-21 00:08:13 +01:00
Benjamin Devèze bb219eff8d Remove useless URL instanciation 2014-02-21 00:07:48 +01:00
Kelsey Francis 55101edb46 Fix yamlBuilder() to return YAML builder instead of SMILE
Closes #5185
2014-02-21 00:00:28 +01:00
Lee Hinman 8f8cc7205d Add "locale" parameter to query_string and simple_query_string
Fixes #5128

Remove java 7 specific Locale functions, add "coming[1.1.0]" to documentation

add LocaleUtils utility class for dealing with Locale functions
2014-02-20 15:53:08 -07:00
Adrien Grand 96d028e721 Disable RAM usage estimation on Lucene 3.x segments.
Close #5201
2014-02-20 23:45:22 +01:00
uboness 428080b49a Changed the caching of FieldDataSource in aggs to be based on field name + required Value Source type as a combi key (used to be only field name). This fixes a problem where multiple aggregations where defined on the same field, yet require different types of value sources.
Closes #5190
2014-02-20 22:33:32 +01:00
David Pilato ecb3df6f4c Wait for REST Service to start
When running tests for site plugins, it could happen that the REST Service is not fully started and not ready immediately to serve HTTP requests.
It gives `503 Service Unavailable` error in that case.

This patch will gives 5 seconds before failing the test.
2014-02-20 17:57:58 +01:00
Isabel Drost-Fromm ff7a9ff1fd Fixing license headers. 2014-02-20 14:35:57 +01:00
Isabel Drost-Fromm 48004ff8a5 Add mustache templating to query execution.
Adds support for storing mustache based query templates that can later be filled
with query parameter values at execution time. Templates may be both quoted,
non-quoted and referencing templates stored in config/scripts/*.mustache by file
name.

See docs/reference/query-dsl/queries/template-query.asciidoc for templating
examples.

Implementation detail: mustache itself is being shaded as it depends directly on
guava - so having it marked optional but included in the final distribution
raises chances of version conflicts downstream.

Fixes #4879
2014-02-20 12:21:59 +01:00
Adrien Grand f5b3c08df2 Make _exists_/_missing_ behave consistently with exists/missing.
`_exists_` and `_missing_` miss field name expansion that `exists` and
`missing` have, which allows these filters to work on `object` fields.

Close #5142
2014-02-20 09:01:56 +01:00
Simon Willnauer d5f1e6f236 [TEST] Update testNGramCopyField to reflect the effect of an index_analyzer 2014-02-19 22:51:34 +01:00
javanna 1bca4971fa [TEST] Added index templates tests for broken mapping and invalid settings scenarios 2014-02-19 20:03:12 +01:00
Simon Willnauer 8fe4d878eb Added tests for empty token chars on ngram tokenizer
This relates to #5120
2014-02-19 19:08:35 +01:00
javanna 1a48c5fc21 [TEST] Initialization errors are checked before returning "no tests to run" error
If there initialization errors and no tests to execute at the same time, better to return the initialization errors, whose check should be first then, as it might be that the "no tests to execute" is caused by the initialization errors.
2014-02-19 19:02:15 +01:00
javanna 1d543432dd [TEST] Added tests for alias filter that is valid json but not a valid filter 2014-02-19 12:42:46 +01:00
javanna d3ed795372 Alias code cleanup
- Renamed IndexMetaData#removerAlias to removeAlias
- Removed IndexTemplateMetaData#fromXContentStandalone unused method (relates to #4511)
- MetaDataIndexAliasesService fix typo in comment
- Alias removed unused constructor that accepts both alias name and filter
2014-02-19 12:04:30 +01:00
Simon Willnauer 4902dd1da6 Add test and randomization for #5165 2014-02-19 11:06:09 +01:00
jayesh.modi 3dec916ef2 Fix SearchContext from being closed prematurely
Fixes SearchContext from being closed during initialization or immediately
after processing is started

Closes #5165
2014-02-19 11:06:09 +01:00
constantijn 369dba126c [DOCS] Javadoc: delete index request does not support empty String
In 0.90.x I was able to delete all my indices from the java api by calling

    client.admin().indices().prepareDelete(new String[] {}).execute().actionGet();

However this fails in 1.0.0 with

org.elasticsearch.action.ActionRequestValidationException: Validation Failed: 1: index / indices is missing;
	at org.elasticsearch.action.ValidateActions.addValidationError(ValidateActions.java:29)
	at org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest.validate(DeleteIndexRequest.java:72)
	*snip long stacktrace*

which points me to

    public ActionRequestValidationException validate() {
        ActionRequestValidationException validationException = null;
        if (indices == null || indices.length == 0) {
            validationException = addValidationError("index / indices is missing", validationException);
        }
        return validationException;
    }

So that's what now throws the error, however the documentation still says:

    /**
     * Deletes an index based on the index name.
     *
     * @param indices The indices to delete. Empty array to delete all indices.
     */
    DeleteIndexRequestBuilder prepareDelete(String... indices);

Closes #5164.
Closes #5167.
Closes #5168.
2014-02-19 10:31:32 +01:00
Shay Banon 86a883b4bf support help as well as h in direct cat call to list all actions 2014-02-18 21:55:08 +02:00
Alexander Reelsen 565c212732 Set permission in debian postinst script correctly
The old post installation script on debian set all data to
644 inside of /etc/elasticsearch, which does not work, when
there are subdirectories

Closes #3820
2014-02-18 13:22:28 +01:00
David Pilato 5d159369ef Source filtering with wildcards broken when given multiple patterns
```
curl -XPUT 'http://localhost:9200/twitter/tweet/1' -d '{
    "user" : "kimchy",
    "post_date" : "2009-11-15T14:12:12",
    "message" : "trying out Elasticsearch", "retweeted": false
}'
```

No source fields delivered:

```
curl -XGET 'http://localhost:9200/twitter/tweet/1?_source=*.id,retweeted&pretty=yes'
```

`retweeted` returned:

```
curl -XGET 'http://localhost:9200/twitter/tweet/1?_source=retweeted,*.id&pretty=yes'
```

Closes #5132.
Closes #5133.
2014-02-17 18:15:30 +01:00
Luca Cavanna 3afdf4a872 Added support for aliases to create index api
It is now possible to specify aliases during index creation:

curl -XPUT 'http://localhost:9200/test' -d '
{
    "aliases" : {
        "alias1" : {},
        "alias2" : {
            "filter" : { "term" : {"field":"value"}}
        }
    }
}'

Closes #4920
2014-02-17 14:54:21 +01:00
Shay Banon 8601529be8 Optimize multiple cluster state processing on receiving nodes
Nodes that receive the cluster state, and they have several of those pending, can optimize and try and process potentially only one of those.
closes #5139
2014-02-17 11:10:49 +01:00
Britta Weber db3c6c2a8e Enable percolation for nested documents
closes #5082
2014-02-14 22:42:33 +01:00
Lee Hinman de91ffd0ce Fix license header for SimpleQueryParser 2014-02-14 11:55:49 -07:00
Lee Hinman c97bcc3602 Add support for `lowercase_expanded_terms` flag to simple_query_string
Default the flag to true, making simple_query_string behave similarly to
query_string

Fixes #5008
2014-02-14 11:51:23 -07:00
Nik Everett 5c3f4ceafb Add preserve original token option to ASCIIFolding
Closes #4931
2014-02-14 19:37:00 +01:00
Martijn van Groningen d8f498226a Fixed issue where highlighting in percolate existing doc api doesn't work (no highlight snippets) 2014-02-14 11:54:25 -05:00
Martijn van Groningen b591d7fef7 Make sure that parent type is created explicitly.
Cleaned up the p/c integration tests to use shorter mapping definition, ensureGreen() and .get()
2014-02-14 11:39:06 -05:00
Brian Yoder 41dba68bda Added the `DistanceUnit.NAUTICALMILES` enumeration
label with the corresponding *NM* and *nmi* unit
suffixes. Update the docs to match.

Closes #5085
2014-02-14 19:48:58 +09:00
Lee Hinman 28c6dc3e19 Allow specifying nested fields in simple_query_string
Fixes #5091
2014-02-13 09:31:33 -07:00
Martijn van Groningen d005a105ac Made highlight query also work in the percolate api. 2014-02-12 10:13:35 -05:00
Simon Willnauer 411af96044 Minor cleanups in ShardsLimitAllocationDecider 2014-02-12 12:50:55 +01:00
Luca Cavanna 129c0a3a3f Improved ClusterSettingsTests
more assertAcked, checked that the `discovery.zen.publish_timeout` has been changed in `DiscoverySettings`, removed restriction on number of nodes, doesn't seem needed.
2014-02-12 10:45:37 +01:00
Simon Willnauer 0b4bf88dae Beefed up DeleteByQueryTests to run not just against a single document 2014-02-11 16:23:16 +01:00
Simon Willnauer a06a00b37e Added test #5078 2014-02-11 15:58:57 +01:00
Simon Willnauer 990ce658a4 [Docs] Remove `custom_score` from documentation and add a migration
section.
2014-02-11 14:59:15 +01:00
Simon Willnauer 006075f01e Remove `custom_score` and `custom_boost_factor` queries
`custom_boost_factor` and `custom_score` were deprecated in `0.90.5`
and their documentation was removed already in `1.0`. This commit
removes all support for those queries since they are supercede by
`function_score`.
2014-02-11 14:59:15 +01:00
Luca Cavanna 766134f3c7 Made possible to dynamically update `discovery.zen.publish_timeout` cluster setting
`discovery.zen.publish_timeout` controls how long the master node is going to try and wait for all the nodes to respond to a cluster state publish before going ahead with the following updates in the queue (default 30s). Up until now changing the settings required restarting each node. The setting is now dynamic and can be changed through the cluster update settings api.

Closes #5063
2014-02-11 12:04:28 +01:00
Alexander Reelsen b02e6dc996 Migrating NodesInfo API to use plugins instead of singular plugin
In order to be consistent (and because in 1.0 we switched from
parameter driven information to specifzing the metrics as part of the URI)
this patch moves from 'plugin' to 'plugins' in the Nodes Info API.
2014-02-11 10:05:10 +01:00
Simon Willnauer 06f8a2e1a3 Fix AndDocIdSet#IteratorBasedIterator to not violate initial doc state
AndDocIdSet#IteratorBasedIterator was potentially initialized with
NO_MORE_DOCS which violates the initial state of DocIdSetIterator and
could lead to undefined behavior when used in a search context.

Closes #5049
2014-02-10 18:14:10 +01:00
Luca Cavanna 1161e0f6f1 more AbstractRestResponseActionListener in RestThreadPoolAction (cat api) 2014-02-10 16:20:04 +01:00
Simon Willnauer dc308db4fe [TEST] Add basic test for /cat/shards/{index}
Basic REST test for rendering the cat/shards endpoint.
2014-02-10 12:23:01 +01:00
Shay Banon e5f43a1867 add version and master_node flags to cluster state 2014-02-10 02:24:03 +01:00
Shay Banon 152edd1804 Bulk process of shard started/failed should not execute on already processed events
closes #5061
2014-02-10 01:21:58 +01:00
uboness b3cb59d024 Fixed parsing time zones as numeric value in DateHistogramParser
Closes #5057
2014-02-09 22:05:36 +01:00
Adrien Grand 6e46ca29d4 Log warning in case of double release of the IndexSearcher instead of throwing an exception. 2014-02-07 15:24:08 +01:00
Adrien Grand 5bff4ec1d5 Add a aggregation test that uses `doc.score` to make sure we don't forget to set the Scorer. 2014-02-07 14:51:15 +01:00
Luca Cavanna a76620e3ac [TEST] run REST tests against multiple nodes (round-robin)
Multiple nodes are now started when running REST tests against the `TestCluster` (default randomized settings are now used instead of the hardcoded `1`)

Added also randomized round-robin based on all available nodes, and ability to provide multiple addresses when running tests against an external cluster to have the same behaviour
2014-02-07 13:52:48 +01:00
David Pilato 8b1c25e11f Upgrading analysis plugins fails
When an analysis plugins provides default index settings using `PreBuiltAnalyzerProviderFactory`,  `PreBuiltTokenFilterFactoryFactory` or `PreBuiltTokenizerFactoryFactory` it fails when upgrading it with elasticsearch superior or equal to 0.90.5.

Related issue: #4936

Fix is needed in core. But, in the meantime, analysis plugins developers can fix that issue by overloading default prebuilt factories.

For example:

```java
public class StempelAnalyzerProviderFactory extends PreBuiltAnalyzerProviderFactory {

    private final PreBuiltAnalyzerProvider analyzerProvider;

    public StempelAnalyzerProviderFactory(String name, AnalyzerScope scope, Analyzer analyzer) {
        super(name, scope, analyzer);
        analyzerProvider = new PreBuiltAnalyzerProvider(name, scope, analyzer);
    }

    @Override
    public AnalyzerProvider create(String name, Settings settings) {
        return analyzerProvider;
    }

    public Analyzer analyzer() {
        return analyzerProvider.get();
    }
}
```

And instead of:

```java
    @Inject
    public PolishIndicesAnalysis(Settings settings, IndicesAnalysisService indicesAnalysisService) {
        super(settings);
        indicesAnalysisService.analyzerProviderFactories().put("polish", new PreBuiltAnalyzerProviderFactory("polish", AnalyzerScope.INDICES, new PolishAnalyzer(Lucene.ANALYZER_VERSION)));
    }
```

do

```java
    @Inject
    public PolishIndicesAnalysis(Settings settings, IndicesAnalysisService indicesAnalysisService) {
        super(settings);
        indicesAnalysisService.analyzerProviderFactories().put("polish", new StempelAnalyzerProviderFactory("polish", AnalyzerScope.INDICES, new PolishAnalyzer(Lucene.ANALYZER_VERSION)));
    }
```

Closes #5030
2014-02-07 12:20:34 +01:00
Simon Willnauer 7a84b94e29 Extend ElasticsearchLuceneTestCase rather than LuceneTestCase
LuceneTestCase misses some thread filters that might fail a test
since a background cluster is still running from a previous test.
2014-02-07 12:02:11 +01:00
tstibbs 8fabd477b8 fixed trace logging hidden by check for isDebugEnabled 2014-02-07 10:38:45 +01:00
Adrien Grand 9cb17408cb Make size=0 return all buckets for the geohash_grid aggregation.
Close #4875
2014-02-07 09:55:10 +01:00
Adrien Grand e1c1120949 Fix BytesRef owning issue in string terms aggregations.
The byte[] array that was used to store the term was owned by the BytesRefHash
which is used to compute counts. However, the BytesRefHash is released at some
point and its content may be recycled.

MockPageCacheRecycler has been improved to expose this issue (putting random
content into the arrays upon release).

Number of documents/terms have been increased in RandomTests to make sure page
recycling occurs.

Close #5021
2014-02-07 09:46:06 +01:00
Simon Willnauer 0fb8d982be Use patched version of ReferenceManager to prevent infinite loop in
RefrenceManager#accquire()

See LUCENE-5436
2014-02-06 21:45:38 +01:00
Adrien Grand aab2c7a444 Be paranoid about double release. 2014-02-06 21:00:56 +01:00
Lee Hinman d2078a5e28 Add fuzzy/slop support to `simple_query_string`
Ports the change from https://issues.apache.org/jira/browse/LUCENE-5410
2014-02-06 10:05:10 -07:00
Simon Willnauer 162ca99376 Added `cross_fields` mode to multi_match query
`cross_fields` attemps to treat fields with the same analysis
configuration as a single field and uses maximum score promotion or
combination of the scores based depending on the `use_dis_max` setting.
By default scores are combined. `cross_fields` can also search across
fields of hetrogenous types for instance if numbers can be part of
the query it makes sense to search also on numeric fields if an analyzer
is provided in the reqeust.

Relates to #2959
2014-02-06 17:15:55 +01:00
Adrien Grand 728e0e2a2e Ignore case when parsing `script_values_sorted|unique` in aggregations.
Close #5009
2014-02-06 12:01:00 +01:00
Adrien Grand 4e9fa5c9f4 Add Version.1_1_0 (missing in master but already in 1.x). 2014-02-05 11:47:07 +01:00
Adrien Grand 6777be60ce Add script support to value_count aggregations.
Close #5001
2014-02-04 14:29:32 +01:00
Adrien Grand 9333a3c28a Fix hashCode values of aggregations' BytesValues.
This commit removes FilterBytesValues which is very trappy as the default
implementation forwards all method calls to the delegate. So if you do any
non-trivial modification to the terms or to the order of the terms, you need
to remember to override currentValueHash, copyShared, and this is very
error-prone.

FieldDataSource.WithScript.BytesValues and ScriptBytesValues now return correct
hash codes, future bugs here would be catched by the new assertion in
SortedUniqueBytesValues.

This bug was causing performance issues with scripts as all terms were assumed
to have the same hash code.

Close #5004
2014-02-04 14:16:09 +01:00
Luca Cavanna 56f4fcb5df [TEST] thrown error when there are no REST tests to run 2014-02-04 13:05:49 +01:00
Simon Willnauer bd8cb4eb1b Add [0.90.11] version as a constant 2014-02-03 16:27:02 +01:00
Shay Banon d591972c18 Remove the in memory buffer Lucene store/directory
closes #4994
2014-02-03 09:52:19 -05:00
Luca Cavanna 56d3e98fff [TEST] added ability to filter REST test sections to run
Added `tests.rest.section` parameter that allows to filter the test sections that get executed via regex (case insensitive)
2014-02-03 15:30:58 +01:00
Simon Willnauer f0774eb5d1 Added dedicated test for MultiMatchQuery 2014-02-03 13:04:33 +01:00
markharwood 82c7c81653 Added tests for match/multimatch queries with invalid “type” JSON param 2014-02-03 11:51:31 +00:00
Luca Cavanna 88771fdf99 [TEST] Added ability to test apis that don't return json
The last response body gets now always stashed in the REST tests and can be retrieved via `$body`. This implies that not only expected values can be retrieved from the stashed values, but actual values as well.

Added support for regular expressions to `match` assertion, using `Pattern.COMMENTS` flag for better readability through new custom hamcrest matcher (adopted in do section as well). Functionality added through new feature called `regex` that needs to be mentioned in the skip sections whenever needed till all the runners support it.

Added also example tests for cat count api
2014-02-03 11:26:38 +01:00
markharwood 5f8dbeaa8e Added exception if passed an invalid type param
Closes #4964
2014-02-03 10:09:38 +00:00
Luca Cavanna 1ca565cf9f [TEST] Added check that yaml REST test suites always end with \n
Our yaml parser seems to be too tolerant in some cases, e.g. it properly parses yaml suites when they don't end with a line feed, whereas other clients tests break due to that. We should try to do the same to keep consistency across runners.
2014-02-03 10:05:35 +01:00
George P. Stathis 74dd33689e Parent / child queries should work with non-default similarities 2014-02-02 09:23:12 +01:00
Martijn van Groningen 244723d401 Added `fields` support to `geo_point` and `completion` field type.
Upgrading 0.90.x `multi_field` type that has a `geo_point` or `completion` field type as default field would otherwise fail.
Also it make sense to support these field types, because both support specifying the actual values as string.
2014-02-02 07:16:36 +01:00
Simon Willnauer 9cf8251a0d Add RamUsageEstimator#sizeOf(Object) to forbidden APIs
This method can be a performance trap since it traverse the
entire object tree that is referenced by the provided object.
See LUCENE-5373
2014-01-31 21:43:20 +01:00
Simon Willnauer 6e18a8945d Prevent usage of object based RamUsageEstimator in Completion090PostingsFormat 2014-01-31 21:16:38 +01:00
Simon Willnauer 3e3170278e Don't load CompetionTerms if lookupFactory is null
Closes #4970
Closes #4788
2014-01-31 21:16:38 +01:00
Igor Motov 90da268237 Remove support for boost in copy_to field
Currently, boosting on `copy_to` is misleading and does not work as originally specified in #4520. Instead of boosting just the terms from the origin field, it boosts the whole destination field.  If two fields copy_to a third field, one with a boost of 2 and another with a boost of 3, all the terms in the third field end up with a boost of 6.  This was not the intention.

  The alternative: to store the boost in a payload for every term, results in poor performance and inflexibility. Instead, users should either (1) query the common field AND the field that requires boosting, or (2) the multi_match query will soon be able to perform term-centric cross-field matching that will allow per-field boosting at query time (coming in 1.1).
2014-01-31 14:34:01 -05:00
Lee Hinman 5448477c54 Add explanations for all AllocationDeciders
Relates to #4380
Relates to #2483
2014-01-31 10:47:23 -07:00
Luca Cavanna d68d8fbf11 [TEST] clarified skip features usage 2014-01-31 18:03:24 +01:00
Luca Cavanna 33d5a722b3 [TEST] Added ability to skip REST test suite/sections based on their required features
As we have different runners for the REST tests we need a mechanism that allows us to add features to any of them without breaking all others builds.
The idea is to name a feature and temporarily use skip sections that mention the required new features, so that runners that don't support it will skip the test.

Added support for `features` field in skip section.
Added `Features` class that contains a static list of the features supported by the runner. If a feature mentioned in a skip section is not listed here, the test will be skipped.
2014-01-31 16:47:40 +01:00
Martijn van Groningen f60f72f19b Added missing licence header 2014-01-31 10:19:32 +01:00
Martijn van Groningen 0d9197a1d3 The binary field shouldn't be stored by default, because it is already available in the _source. 2014-01-31 10:15:51 +01:00
Martijn van Groningen b9707b395d Added benchmark for scroll searches. 2014-01-31 10:12:32 +01:00
Shay Banon ae3e8beca4 filtered query parses _name incorrectly
fixes #4960
2014-01-30 21:32:52 +01:00
Simon Willnauer dddfe23bed Randomized number of shards / replicas & add mapping for numeric fields 2014-01-30 20:42:31 +01:00
Mark Conlin cd9be4364f Improve boolean handling in snapshot/restore request parsing
Fixes #4949
2014-01-30 13:16:53 -05:00
Martijn van Groningen 7e1eed9814 The forceful no cache behaviour for range filter with now date match expression should only be active if no rounding has been specified for `now` in the date range range expression (for example: `now/d`).
Also the automatic now detection in range filters is overrideable by the `_cache` option.

 Closes #4947
 Relates to #4846
2014-01-30 15:51:33 +01:00
David Pilato abf9a86678 Add version to plugins
Plugin developpers can now add a version number to their es-plugin.properties file:

```properties
plugin=org.elasticsearch.test.integration.nodesinfo.TestPlugin
version=0.0.7-SNAPSHOT
```

Also, for site plugins, it's recommended to add a `es-plugin.properties` file in root site directory with `description` and `version` properties:

```properties
description=This is a description for a dummy test site plugin.
version=0.0.7-BOND-SITE
```

When running Nodes Info API, you will get information on versions:

```sh
$ curl 'http://localhost:9200/_nodes?plugin=true&pretty'
```

```javascript
{
  "ok" : true,
  "cluster_name" : "test-cluster-MacBook-Air-de-David.local",
  "nodes" : {
    "RHMsToxiRcCXwHiS6mEaFw" : {
      "name" : "node2",
      "transport_address" : "inet[/192.168.0.15:9301]",
      "hostname" : "MacBook-Air-de-David.local",
      "version" : "0.90.0.Beta2-SNAPSHOT",
      "http_address" : "inet[/192.168.0.15:9201]",
      "plugins" : [ {
        "name" : "dummy",
        "version" : "0.0.7-BOND-SITE",
        "description" : "This is a description for a dummy test site plugin.",
        "url" : "/_plugin/dummy/",
        "site" : true,
        "jvm" : false
      } ]
    },
    "IKiUOo-LSCq1Km1GUhBwPg" : {
      "name" : "node3",
      "transport_address" : "inet[/192.168.0.15:9302]",
      "hostname" : "MacBook-Air-de-David.local",
      "version" : "0.90.0.Beta2-SNAPSHOT",
      "http_address" : "inet[/192.168.0.15:9202]",
      "plugins" : [ {
        "name" : "test-plugin",
        "version" : "0.0.7-SNAPSHOT",
        "description" : "test-plugin description",
        "site" : false,
        "jvm" : true
      } ]
    },
    "H64dcSF2R_GNWh6XRCYZJA" : {
      "name" : "node1",
      "transport_address" : "inet[/192.168.0.15:9300]",
      "hostname" : "MacBook-Air-de-David.local",
      "version" : "0.90.0.Beta2-SNAPSHOT",
      "http_address" : "inet[/192.168.0.15:9200]",
      "plugins" : [ ]
    },
    "mGEZcYl8Tye0Rm5AACBhPA" : {
      "name" : "node4",
      "transport_address" : "inet[/192.168.0.15:9303]",
      "hostname" : "MacBook-Air-de-David.local",
      "version" : "0.90.0.Beta2-SNAPSHOT",
      "http_address" : "inet[/192.168.0.15:9203]",
      "plugins" : [ {
        "name" : "test-plugin",
        "version" : "0.0.7-SNAPSHOT",
        "description" : "test-plugin description",
        "site" : false,
        "jvm" : true
      }, {
        "name" : "test-no-version-plugin",
        "version" : "NA",
        "description" : "test-no-version-plugin description",
        "site" : false,
        "jvm" : true
      }, {
        "name" : "dummy",
        "version" : "NA",
        "description" : "No description found for dummy.",
        "url" : "/_plugin/dummy/",
        "site" : true,
        "jvm" : false
      } ]
    }
  }
}
```

Relative to #2668.
Closes #2784.
2014-01-30 14:13:46 +01:00
Alexander Reelsen 2c67ba8f1a REST Get Field Mapping API: Fix NPE if field not existent
When fixing #4738, a small issue leaked into the implementation.
The equals check in the RestAction only applied when the master node
returned the rest request, otherwise the object equality would not hold
due to being transferred over the wire and being deserialized into
another object (from and an equality point of view) than the
FieldMappingMetaData.NULL object - this could result in serialization
exceptions as an empty length bytes reference is used in toXContent.
2014-01-30 12:02:52 +01:00
uboness 79d1633dd6 fixed a bug where when executing on a single shard and sorting terms agg based on sub metric agg, the order (asc/desc) is not respected
- fixed tests for terms order

Closes #4951
2014-01-30 06:54:25 +01:00
Lee Hinman 4c06c533e8 Fix javadocs for DeleteResponse.isFound() 2014-01-29 22:29:05 -07:00
Igor Motov 2755eecf65 Add throttling to snaphost and restore operations
Closes #4855
2014-01-29 10:33:59 -05:00
David Pilato 0541456b34 scroll REST API should support source parameter
As stated in documentation, we should support `?source=` parameter in `/_search/scroll` REST operations.

This is how to reproduce it:

```sh
curl -XDELETE "http://localhost:9200/test"
curl -XPOST "http://localhost:9200/test/type/1" -d'
{
    "foo": "bar"
}'

# This one works
curl -XPOST "http://localhost:9200/_search/scroll" -d "FAKESCROLLID"

# This one gives: {"error":"Failed to derive xcontent from org.elasticsearch.common.bytes.BytesArray@0"}
curl -XGET "http://localhost:9200/_search/scroll/?source=FAKESCROLLID"
```

Closes #4941.
2014-01-29 14:43:36 +01:00
Igor Motov 2b80c752df Remove waiting for green in CopyToMapperIntegrationTests 2014-01-29 07:29:35 -05:00
Martijn van Groningen c82f27577b Added dedicated thread pool cat api, that can show all thread pool related statistic (size, rejected, queue etc.) for all thread pools (get, search, index etc.)
By default active, rejected and queue thread statistics are included for the index, bulk and search thread pool.
Other thread statistics of other thread pools can be included via the `h` query string parameter.

Closes #4907
2014-01-29 13:25:06 +01:00
Igor Motov a0e381ad3a Improve test stability 2014-01-29 07:14:27 -05:00
Martijn van Groningen 2de0e60342 Wait for green after indexing doc, so that the mapping update is always after the index operation on replica has completed. (replica shard may needed to catch up) 2014-01-29 12:10:17 +01:00
David Pilato d621ab9958 Fix potential NPE when no source and no body
In recent changes, we added missing support for `source` parameter in some REST APIs:

* #4892 : mget
* #4900 : mpercolate
* #4901 : msearch
* #4902 : mtermvectors
* #4903 : percolate

```java
        BytesReference content = null;
        if (request.hasContent()) {
            content = request.content();
        } else {
            String source = request.param("source");
            if (source != null) {
                content = new BytesArray(source);
            }
        }
```

It's definitely better to have:

```java
        BytesReference content = request.content();
        if (!request.hasContent()) {
            String source = request.param("source");
            if (source != null) {
                content = new BytesArray(source);
            }
        }
```

That said, it could be nice to have a single method to manage it for various REST actions.

Closes #4924.
2014-01-28 18:15:27 +01:00
uboness dd389d1cc5 Made all multi-bucket aggs return consistent response format
Closes #4926
2014-01-28 17:46:57 +01:00
Simon Willnauer f9d1552282 Use #ensureSearchable() in GeoHashGridTests 2014-01-28 15:11:49 +01:00
Simon Willnauer 25f0bba30c Use num of actual threads if busiestThreads is larger
We currently use the number of hot threads that we are
interested in as the value for iterating over the actual
hot threads which can lead to AIOOB is the actual number
of threads is less than the given number.

Closes #4927
2014-01-28 14:23:42 +01:00
uboness 2ba2fb193d fixed compilation error on jdk7 2014-01-28 14:12:51 +01:00
Simon Willnauer b21b7ac40f Make test more reliable 2014-01-28 13:32:34 +01:00
uboness fc6bc4c477 cleanup of aggregations api
- add javadocs
- remove Iterable from all multi-bucket aggregations
- all single-bucket aggregations should have getDocCount() and getAggregations()
- all multi-bucket aggregations should have getBuckets() that returns Collection
- every multi-bucket aggregation should have these methods:
 - getBuckets() : Collection
 - getBucketByKey(String) : Bucket
 - getBucketByKey(Number) : Bucket (only for numeric buckets)
 - getBucketByKey(DateTime) : Bucket (only for date buckets)
 - getBucketByKey(GeoPoint) : Bucket (only for geohash_grid)
- every bucket in all multi-bucket aggregations should have these methods:
 - getKey() : String
 - getKeyAsText() : Text
 - getKeyAsNumber() : Number (if the key can be numeric value, eg. range & histograms)
 - getKeyAsGeoPoint() : GeoPoint (in case of the geohash_grid agg)

 Closes #4922
2014-01-28 13:28:04 +01:00
Luca Cavanna b61ca9932a [DOCS] Clarified docs for cluster.routing.allocation.same_shard.host cluster setting
Clarified also javadocs for SameShardAllocationDecider
2014-01-28 12:32:37 +01:00
Martijn van Groningen cb75830c68 Fixed failure for testDeletePercolatorType where the .percolator mapping hasn't propagated to master that was dynamically created via an index call, which made the delete mapping call fail. 2014-01-28 11:19:57 +01:00
Simon Willnauer b5a6a5a6ed Ignore internal errors if JVM can't find the memory pool 2014-01-28 11:11:41 +01:00
Simon Willnauer 91acca7836 Upgrade to Lucene 4.6.1
This upgrade includes a fix for RAM estimation on IndexReader
that allows to expose the amount of used bytes per segment now
as a setting in Elasticsearch. (LUCENE-5373)

Additionally this bugfix release contained a small fix for highlighting
that was already ported to Elasticsearch when reported (LUCENE-5361)

Closes #4897
2014-01-28 10:35:39 +01:00
David Pilato 1da5f3af67 Fix for #4902 2014-01-28 10:12:32 +01:00
Martijn van Groningen 6aaddb03f1 Changed p/c benchmarks to use random generated parent ids, index parent and its children in a non deterministic order and let query values match with multiple child / parent documents. 2014-01-28 10:11:00 +01:00
David Pilato 8706cf610a percolate REST API should support source parameter
As stated in documentation, we should support `?source=` parameter in percolate REST operations.

This is how to reproduce it:

```sh
curl -XDELETE "http://localhost:9200/test"

curl -XPUT "http://localhost:9200/test/.percolator/1" -d'
{
    "query" : {
        "match" : {
            "foo" : "bar"
        }
    }
}'

# This one works
curl -XPOST "http://localhost:9200/test/message/_percolate" -d '{
  "doc" : {
    "foo" : "bar is in foo"
  }
}'

# This one gives: BroadcastShardOperationFailedException[[test][2] ]; nested: PercolateException[failed to percolate]; nested: ElasticsearchIllegalArgumentException[Nothing to percolate];
curl -XGET "http://localhost:9200/test/message/_percolate?source=%7B%22doc%22%3A%7B%22foo%22%3A%22bar%20is%20in%20foo%22%7D%7D"
```

Closes #4903.
2014-01-28 09:43:28 +01:00
David Pilato 71b8876d83 mtermvectors REST API should support source parameter
As stated in documentation, we should support `?source=` parameter in msearch REST operations.

This is how to reproduce it:

```sh
curl -XDELETE "http://localhost:9200/test"

curl -XPOST "http://localhost:9200/test/type/1?refresh" -d'{
    "foo": "bar"
}'

# This one works
curl -XPOST "http://localhost:9200/test/type/_mtermvectors" -d'
{
    "ids" : ["1"]
}'

# This one gives: "ActionRequestValidationException[Validation Failed: 1: multi term vectors: no documents requested;]"
curl -XGET "http://localhost:9200/test/type/_mtermvectors?source=%7B%22ids%22%3A%5B%221%22%5D%7D"
```

Closes #4902.
2014-01-28 09:40:35 +01:00
David Pilato bf3d20eb05 msearch REST API should support source parameter
As stated in documentation, we should support `?source=` parameter in msearch REST operations.

This is how to reproduce it:

```sh
curl -XDELETE "http://localhost:9200/test"

curl -XPOST "http://localhost:9200/test/type/1?refresh" -d'{
    "foo": "bar"
}'

cat requests
{}
{"query" : {"match_all" : {}}}

# This one works
curl -XGET localhost:9200/_msearch --data-binary @requests

# This one gives: {"error":"Failed to derive xcontent from org.elasticsearch.common.bytes.BytesArray@0"}
curl -XGET "http://localhost:9200/test/type/_mget?source=%7B%7D%0A%7B%22query%22%3A%7B%22match_all%22%3A%7B%7D%7D%7D%0A"
```

Closes #4901.
2014-01-28 09:39:44 +01:00
David Pilato 03c02143dd mpercolate REST API should support source parameter
As stated in documentation, we should support `?source=` parameter in mpercolate REST operations.

This is how to reproduce it:

```sh
curl -XDELETE "http://localhost:9200/test"

curl -XPUT "http://localhost:9200/test/.percolator/1" -d'
{
    "query" : {
        "match" : {
            "foo" : "bar"
        }
    }
}'

# This one works
curl -XPOST "http://localhost:9200/test/message/_mpercolate" -d '
{"percolate" : {}}
{"doc" : {"foo" : "bar is in foo"}}
'

# This one gives: BroadcastShardOperationFailedException[[test][2] ]; nested: PercolateException[failed to percolate]; nested: ElasticsearchIllegalArgumentException[Nothing to percolate];
curl -XGET "http://localhost:9200/test/message/_mpercolate?source=%7B%22percolate%22%3A%7B%7D%7D%0A%7B%22doc%22%3A%7B%22foo%22%3A%22bar is in foo%22%7D%7D%0A"
```

Closes #4900.
2014-01-28 09:38:30 +01:00
Alexander Reelsen 5e58f4066e REST API: Consistent get field mapping response
If a get field mapping request is issued, and all but the field can be
found, the response should return an empty JSON object instead of a 404.

Closes #4738
2014-01-28 08:12:53 +01:00
markharwood d9699e02f4 Changed GeoEncodingTests to ensure accuracy always >1mm due to rounding errors with very small numbers 2014-01-27 17:05:19 +00:00
Martijn van Groningen f38296da61 Percolator response now always returns the `matches` key.
Closes #4881
2014-01-27 16:37:09 +01:00
Lee Hinman 04c41fe349 Add missing PHRASE flag for simple_query_string
Closes #4911
2014-01-27 07:18:32 -07:00
Luca Cavanna 2ad7f2b8a6 Improved CreateIndexRequest and CreateIndexRequestBuilder javadocs 2014-01-27 14:50:04 +01:00
Luca Cavanna c4edf15633 [TEST] Improved IndexAliasesTests
more assertAcked, removed TODO and needless sleep
2014-01-27 14:50:04 +01:00
Shay Banon c1c2d343c4 move msearch to use atomic array instead of synchronize 2014-01-27 13:22:49 +01:00
Alexander Reelsen 24abb6cf3f Cluster state toXContent serialization only returns needed data
In order to make sure, that only the requested data is returned to the client,
a couple of fixes have been applied in the ClusterState.toXContent() method.
Also some tests were added to the yaml test suite

Closes #4885
2014-01-27 12:04:57 +01:00
Alexander Reelsen 35e5432354 Bulk: Failed preparsing does not fail whole bulk request
If a preparsing of the source is needed (due to mapping configuration,
which extracts the routing/id value from the source) and the source is not
valid JSON, then the whole bulk request is failed instead of a single
BulkRequest.

This commit ensures, that a broken JSON request is not forwarded to the
destination shard and creates an appropriate BulkItemResponse, which
includes a failure.

This also implied changing the BulkItemResponse serialization, because one
cannot be sure anymore, if a response includes an ID, in case it was not
specified and could not be extracted from the JSON.

Closes #4745
2014-01-27 11:33:41 +01:00
David Pilato 4c50770a89 mget REST API should support source parameter
As stated in documentation, we should support `?source=` parameter in mget REST operations.

This is how to reproduce it:

```sh
curl -XDELETE "http://localhost:9200/test"

curl -XPOST "http://localhost:9200/test/type/1?refresh" -d'{
    "foo": "bar"
}'

curl -XPOST "http://localhost:9200/test/type/_mget" -d'{
    "ids": ["1"]
}'

curl -XGET "http://localhost:9200/test/type/_mget?source=%7B%22ids%22%3A%20%5B%221%22%5D%7D"
```

Closes #4892.
2014-01-27 11:05:50 +01:00
Simon Willnauer 1ffdd2ae3f Fix test to use at least one document 2014-01-27 10:42:07 +01:00
Shay Banon b66885dab3 Don't throttle the translog stage of recovery
After copying the index files (which are throttled), we currently throttle the translog as well. The translog phase3 part is performed under a lock, so its better not to throttle it at all, and move it as fast as possible.
2014-01-25 15:47:58 +01:00
Andrew Raines d4f0323917 _cat/allocation: disk.avail can be zero, if so, want to show 100%
Closes #4835
2014-01-24 16:24:45 -06:00
Andrew Raines 92d4cc13c0 _cat/allocation: Guaranteed to have at least zero shards 2014-01-24 16:24:45 -06:00
Simon Willnauer 25b49dd50b Install SecurityManager inside ElasticsearchTestCase for easier randomization
We currently run always with SecurityManager installed. To make sure we
work also without we should randomly swap it out ie. run without the
security manager.
2014-01-24 22:18:05 +01:00
Andrew Raines 4533462025 Add tera and peta to RestTable.renderValue()
Closes #4871
2014-01-24 11:16:11 -06:00
Andrew Raines 4f442497bf Normalize cat headers, add aliases
Closes #4852.
2014-01-24 10:27:03 -06:00
Andrew Raines b34f259313 Remove duplicate cache columns 2014-01-24 10:27:02 -06:00
Luca Cavanna 61158387fe Removed redundant version checks in transport serialization (#4731 leftover) 2014-01-24 16:12:52 +01:00
Luca Cavanna 107a242d38 Removed put/delete warmer tests that were meant to test that the serialization was bw compatible after adding support for acks 2014-01-24 16:05:02 +01:00
Luca Cavanna 1ef3a4a868 Removed duplicated registration of warmers as custom metadata type
Already done in a static block within IndexMetaData
2014-01-24 15:59:07 +01:00
Martijn van Groningen b18ae14555 Removed old serialization logic (<= 1.0-RC1) in readFrom and writeTo methods. 2014-01-24 15:44:40 +01:00
Simon Willnauer 22eb6ba09d Re-Sort config/names 2014-01-24 14:32:50 +01:00
Adrien Grand 9d10c2fca8 Use different field names based on the data type in aggregations tests.
Tests fail once in a while because of a ClassCastException at the mvel level.
We suspect that this happens because a script that is JIT-ed on a specific
data type cannot later be used with another one, but we didn't manage to
reproduce in our development environments, so let's try to change the field
names to see if this error keeps occurring.
2014-01-24 13:48:43 +01:00
Simon Willnauer 663e25ae63 Throw exception if `cluster.name` is specified in TestCluster node settings
We rely on the `cluster.name` setting to be the same across all nodes
and transport clients etc. If a node setting contains `cluster.name`
the test might not work if a random transport client is swapped
in. Passing such a configuration should result in an exception since
it's clearly an illegal state.
2014-01-24 12:11:29 +01:00
Martijn van Groningen 2d58603e81 Added more unit like test that verifies that has_child is never cached even if wrapped by another filter. 2014-01-24 12:03:00 +01:00
uboness 2f32908193 fixed the reduce of InternalGeoHashGrid when executing on a single shard 2014-01-23 21:09:19 +01:00
David Pilato f4411e697e Serving _site plugins do not pick up on index.html for sub directories
If one asks for `http://es:9200/_plugin/PLUGIN_NAME/` and the the plugin's _site directory contains an index.html file, it will be correctly served.

This is not the case for sub directories: a _site/folder/index.html is not served when requesting  `http://es:9200/_plugin/PLUGIN_NAME/folder/` but one gets a 403 Forbidden response as if trying to browse the folder.

Closes #4845.
2014-01-23 20:40:16 +01:00
uboness 56a14e6194 fixed license header indentation 2014-01-23 19:37:08 +01:00
uboness da953700f4 Fixed an issue where there are sug aggregations executing on a single shard, the reduce call was not propagated properly down the agg hierarchy.
Closes #4843
2014-01-23 19:19:55 +01:00
Nik Everett 93a8e80aff Support multiple rescores
Detects if rescores arrive as an array instead of a plain object.  If so
then parse each element of the array as a separate rescore to be executed
one after another.  It looks like this:
   "rescore" : [ {
      "window_size" : 100,
      "query" : {
         "rescore_query" : {
            "match" : {
               "field1" : {
                  "query" : "the quick brown",
                  "type" : "phrase",
                  "slop" : 2
               }
            }
         },
         "query_weight" : 0.7,
         "rescore_query_weight" : 1.2
      }
   }, {
      "window_size" : 10,
      "query" : {
         "score_mode": "multiply",
         "rescore_query" : {
            "function_score" : {
               "script_score": {
                  "script": "log10(doc['numeric'].value + 2)"
               }
            }
         }
      }
   } ]

Rescores as a single object are still supported.

Closes #4748
2014-01-23 16:29:07 +01:00
Simon Willnauer 592a411b2c Make shard balancing deterministic if weights are identical
It happens to be the case that the iteration order of a HashMaps
keyset might be different across runs. This can cause undeterministic
results in shard balancing if weights are identical and multiple shards
of the same index are eligable for relocation. This commit adds
a tie-breaker based on the shard ID to prioritise the lowest shard
ID. This also makes `AddIncrementallyTests#testAddNodesAndIndices`
reproducible.

Closes #4867
2014-01-23 15:57:49 +01:00
Luca Cavanna 3158776438 Parallelized rivers creation in RiverTests#testMultipleRiversStart
Rivers are now registered concurrently from separate threads, one per river.
2014-01-23 15:39:48 +01:00
Luca Cavanna 2058edc117 Made sure rivers _meta documents are retrieved via get with preference _primary
Closes #4864
2014-01-23 15:01:28 +01:00
Simon Willnauer a7a2d9f806 Remove listeners after suite completes in RestTestSuiteRunner
We need to remove the reproduce info printer after the suite
returns otherwise it might print a bogus line if a subsequent
non-rest test fails. The `RunNotifier` is used across suites in
the same JVM and the listener sticks to it.
2014-01-23 14:49:16 +01:00
Paul Horn ed4b15fb4c ClearScrollRequest should set a type parameter
Since ActionRequest requires a bounded type parameter.
2014-01-23 10:49:23 +01:00
Luca Cavanna 922f51fdd5 Added log line to better debug where rivers will get allocated 2014-01-22 23:26:16 +01:00
Simon Willnauer 0a97134757 Add unit tests for NoCache filter infrastructure
If a filter implements `NoCacheFilter` itself and it's
parents should never be cached even if `_cache` is set
to `true` on the parents explicitly.
2014-01-22 14:56:40 +01:00
uboness e9b41c92a4 Added missing support for min_doc_count in DateHistogramBuilder
Closes: #4848
2014-01-22 14:26:28 +01:00
Martijn van Groningen 6cdbdaf388 Added test that verifies that p/c filters never cache.
Made the has_parent & has_child filterbuilder's cache options a noop as well, like it is in the related parsers.

Relates to #4757
2014-01-22 13:35:52 +01:00
Adrien Grand f466b8f292 Add a basic test for date math in date ranges. 2014-01-22 13:30:09 +01:00
Martijn van Groningen f002d39544 Never cache a range filter that uses the `now` date expression.
Closes #4846
2014-01-22 13:28:08 +01:00
Simon Willnauer 1615aba114 Replace Version checks against 1.0 with 1.0RC2 2014-01-22 12:02:37 +01:00