Commit Graph

9712 Commits

Author SHA1 Message Date
uboness 5df9c048fe Introduced a transient context to the rest request
Similar to the one in `TransportMessage`. Added the `ContextHolder` base class where both `TransportMessage` and `RestRequest` derive from

Now next to the known headers, the context is always copied over from the rest request to the transport request (when the injected client is used)
2014-09-05 16:54:46 +02:00
Alexander Reelsen 8b8cc80ba8 TransportClient: Mark transport client as such when instantiating
This allows plugins to load/inject specific classes, when the client started
is a transport client (compared to being a node client).

Closes #7552
2014-09-05 15:01:14 +02:00
Alex Ksikes 07d741c2cb Term Vectors: Support for artificial documents
This adds the ability to the Term Vector API to generate term vectors for
artifical documents, that is for documents not present in the index. Following
a similar syntax to the Percolator API, a new 'doc' parameter is used, instead
of '_id', that specifies the document of interest. The parameters '_index' and
'_type' determine the mapping and therefore analyzers to apply to each value
field.

Closes #7530
2014-09-05 07:42:43 +02:00
Adrien Grand b49853a619 Internal: Upgrade Guava to 18.0.
17.0 and earlier versions were affected by the following bug
https://code.google.com/p/guava-libraries/issues/detail?id=1761
which caused caches that are configured with weights that are greater than
32GB to actually be unbounded. This is now fixed.

Relates to #6268
Close #7593
2014-09-04 20:14:59 +02:00
Clinton Gormley c88f55ab52 Docs: Fixed typo in windows-as-a-service 2014-09-04 16:12:46 +02:00
javanna a857798e1c Indexed scripts: make sure headers are handed over to internal requests and streamline versioning support
The get, put and delete indexed script apis map to get, index and delete api and internally create those corresponding requests. We need to make sure that the original headers are handed over to the new request by passing the original request in the constructor when creating the new one.

Also streamlined the support for version and version_type in the REST layer since the parameters were not consistently parsed and set to the internal java API requests.

Modified the REST delete template and delete script actions to make use of a client instead of using the `ScriptService` directly.

Closes #7569
2014-09-04 16:00:32 +02:00
uboness 221eafab59 Refactored TransportMessage context
Removed CHM in favour of an OpenHashMap and synchronized accessor/mutator methods. Also, the context is now lazily inititialied (just like we do with the headers)
2014-09-04 15:11:28 +02:00
javanna 6633221470 Internal: deduplicate useful headers that get copied from REST to transport requests
The useful headers are now stored into a `Set` instead of an array so we can easily deduplicate them. A set is also returned instead of an array by the `usefulHeaders` static getter.

Relates to #6513

Closes #7590
2014-09-04 15:04:11 +02:00
Adrien Grand 4ca2dd0a0a Core: Remove DocSetCache.
This class was unused.

Close #7582
2014-09-04 11:03:16 +02:00
Nik Everett 7bcd09a134 [docs] fix typo in language analyzer docs 2014-09-04 09:33:00 +02:00
mdalton 9646083c5a [Docs] Fix incorrect eclipse m2e markdown syntax
Closes #7546.
2014-09-04 06:20:29 +02:00
Colin Goodheart-Smithe 228778ceed Aggregations: Fixes resize bug in Geo bounds Aggregator
Closes #7556
2014-09-03 15:14:07 +01:00
javanna 5b5f4add1e [TEST] added test to verify GetIndexedScriptRequest serialization after recent changes 2014-09-03 15:16:13 +02:00
javanna 5ac77f79c2 [TEST] replaced assert with actual assertions in TemplateQueryTest 2014-09-03 15:16:13 +02:00
Britta Weber 59ecfd67e8 _boost: Fix "index" setting
Serialization if "index" setting for boost did not work since
the serialization was just true/false instead of valid options
"no"/"not_analyzed"/"analyzed".

closes #7557
2014-09-03 14:25:18 +02:00
javanna 4dab138db7 [TEST] resolved warning in IndexedScriptTests 2014-09-03 14:05:24 +02:00
javanna 19418749e4 Java api: change base class for GetIndexedScriptRequest and improve its javadocs
`GetIndexedScriptRequest` now extends `ActionRequest` instead of `SingleShardOperationRequest`, as the index field that was provided with the previous base class is not needed (hardcoded).

Closes #7553
2014-09-03 12:33:37 +02:00
javanna 851cb3ae8a Internal: fix members visibility, remove unused constant and needless try catch in indexed scripts transport actions 2014-09-03 11:57:10 +02:00
javanna 151b1c47d4 Java api: remove needless copy constructor from DeleteIndexedScriptRequest 2014-09-03 11:57:10 +02:00
javanna 4364b59846 Internal: remove unused constructor and adjust methods visibility in DelegatingActionListener 2014-09-03 11:57:10 +02:00
Renaud AUBIN 4c21db0dca Packaging: Add default oracle jdk 7 (x64) path in debian init script
On Debian amd64, oracle jdk .deb packages made using make-jpkg (from
java-package) default to /usr/lib/jvm/jdk-7-oracle-x64.

Closes #7312
2014-09-03 10:15:35 +02:00
Adrien Grand 4bfad644b3 Aggregations: Forbid usage of aggregations in conjunction with search_type=SCAN.
Aggregations are collection-wide statistics, which is incompatible with the
collection mode of search_type=SCAN since it doesn't collect all matches on
calls to the search API.

Close #7429
2014-09-03 09:03:01 +02:00
Adrien Grand 203e80e650 Aggregations: Only return aggregations on the first page when scrolling.
Aggregations are collection-wide statistics so they would always be the same.
In order to save CPU/bandwidth, we can just return them on the first page.

Same as #1642 but for aggregations.
2014-09-03 09:03:01 +02:00
Boaz Leskes 1f8db672fc [Internal] Do not use a background thread to disconnect node which are remove from the ClusterState
After a node fails to respond to a ping correctly (master or node fault detection), they are removed from the cluster state through an UpdateTask. When a node is removed, a background task is scheduled using the generic threadpool to actually disconnect the node. However, in the case of temporary node failures (for example) it may be that the node was re-added by the time the task get executed, causing an untimely disconnect call. Disconnect is cheep and should be done during the UpdateTask.

Closes #7543
2014-09-03 08:49:09 +02:00
Robert Muir 395744b0d2 [Analysis] Add missing docs for latvian analysis 2014-09-02 19:22:59 -04:00
Boaz Leskes 8d3dd61b21 typo s/removeDistruptionSchemeFromNode/removeDisruptionSchemeFromNode 2014-09-02 22:00:44 +02:00
Robert Muir 1711041c57 [Engine] Verify checksums on merge
Enable lucene verification of checksums on segments before merging them.
This prevents corruption from existing segments from silently slipping into
newer merged segments.

Closes #7360
2014-09-02 12:18:19 -04:00
Simon Willnauer b00424aba7 [TEST] Use a large threshold to prevent relocations in RecoveryBackwardsCompatibilityTests 2014-09-02 16:50:19 +02:00
Simon Willnauer cb206c94ec [TEST] Add simple test to test RT Lucene IW settings 2014-09-02 16:33:40 +02:00
Boaz Leskes 89f8f6c51e [Tests] ExternalCluster change error message when use local network mode due to wrong system properties 2014-09-02 15:37:07 +02:00
Boaz Leskes 024df242dc [Tests] add proper error message when BWC client creation fail due to node.local=true system property
System properties are typically set via the command line and therefore override the node settings. If one has `node.local=true` or `node.mode=local` it can result in cryptic error messages during the test run.
2014-09-02 15:37:07 +02:00
mikemccand 9c1ac95ba8 Use Flake IDs instead of random UUIDs when auto-generating id field
Flake IDs give better lookup performance in Lucene since they share
predictable prefixes (timestamp).

Closes #7531

Closes #6004

Closes #5941
2014-09-02 09:13:51 -04:00
Boaz Leskes 20dcb0e08a [Tests] add proper error message when BWC test fail due to node.local=true system property
System properties are typically set via the command line and therefore override the node settings. If one has `node.local=true` or `node.mode=local` it can result in cryptic error messages during the test run.
2014-09-02 14:49:46 +02:00
Boaz Leskes 5d7d86323d [Test] RecoveryBackwardsCompatibilityTests.testReusePeerRecovery used `gateway.recover_after_nodes:3` but may start only a 2 node cluster 2014-09-02 13:38:49 +02:00
Clinton Gormley a059a6574a Update reverse-nested-aggregation.asciidoc
Fixed reverse nested example

Closes #7463
2014-09-02 11:40:41 +01:00
Cristiano Fontes df5d22c7d7 Internal: Removing unused methods/parameters.
Close #7474
2014-09-02 09:38:51 +02:00
mikemccand 53ce7ad764 fix typo 2014-09-01 16:07:05 -04:00
Boaz Leskes 884a744143 [Test] change the default port base for ClusterDiscoveryConfiguration.UnicastZen to 30000
The previous value of 10000 collided with the standard test cluster ports when 6 or more JVMs are used.
2014-09-01 21:40:52 +02:00
Boaz Leskes 246b2583a3 [Test] ElasticsearchIntegrationTest.clearDisruptionScheme should test if the current cluster is internal
When running on a non-internal cluster the function is a noop.
2014-09-01 21:14:30 +02:00
javanna 0d49a8ec76 [TEST] remove global scope mention from ElasticsearchIntegrationTest#buildTestCluster
The global cluster gets created from a static block and shared through all tests in the same jvm. The `buildTestCluster` method can't get called passing in `Scope.GLOBAL`, hence removed its mention from it as it might be misleading. The only two scopes supported within the `buildTestCluster` method are `SUITE` and `TEST`.
2014-09-01 18:34:32 +02:00
Boaz Leskes 598854dd72 [Discovery] accumulated improvements to ZenDiscovery
Merging the accumulated work from the feautre/improve_zen branch. Here are the highlights of the changes:

__Testing infra__
- Networking:
    - all symmetric partitioning
    - dropping packets
    - hard disconnects
    - Jepsen Tests
- Single node service disruptions:
    - Long GC / Halt
    - Slow cluster state updates
- Discovery settings
    - Easy to setup unicast with partial host list

__Zen Discovery__
- Pinging after master loss (no local elects)
- Fixes the split brain issue: #2488
- Batching join requests
- More resilient joining process (wait on a publish from master)

Closes #7493
2014-09-01 16:13:57 +02:00
Boaz Leskes 34f4ca763c [Cluster] Refactored ClusterStateUpdateTask protection against execution on a non master
Previous implementation used a marker interface and had no explicit failure call back for the case update task was run on a non master (i.e., the master stepped down after it was submitted). That lead to a couple of instance of checks.

This approach moves ClusterStateUpdateTask from an interface to an abstract class, which allows adding a flag to indicate whether it should only run on master nodes (defaults to true). It also adds an explicit onNoLongerMaster call back to allow different error handling for that case. This also removed the need for the  NoLongerMaster.

Closes #7511
2014-09-01 15:57:07 +02:00
Boaz Leskes 596a4a0735 [Internal] Extract a common base class for (Master|Nodes)FaultDetection
They share a lot of settings and some logic.

Closes #7512
2014-09-01 15:51:26 +02:00
Britta Weber 889db1c824 [TEST]: remove field_value_factor , was only added 1.2 2014-09-01 15:08:45 +02:00
Britta Weber 40d86a630b Tests: wait for yellow instead of green 2014-09-01 12:26:14 +02:00
javanna ab57d4a002 [TEST] Unify the randomization logic for number of shards and replicas
We currently have two ways to randomize the number of shards and replicas: random index template, that stays the same for all indices created under the same scope, and the overridable `indexSettings` method, called by `createIndex` and `prepareCreate` which returns different values each time.

Now that the `randomIndexTemplate` method is not static anymore, we can easily apply the same logic to both. Especially for number of replicas, we used to have slightly different behaviours, where more than one replicas were only rarely used through random index template, which gets now applied to the `indexSettings` method too (might speed up the tests a bit)

Side note: `randomIndexTemplate` had its own logic which didn't depend on `numberOfReplicas` or `maximumNumberOfReplicas`, which was causing bw comp tests failures since in some cases too many copies of the data are requested, which cannot be allocated to older nodes, and the write consistency quorum cannot be met, thus indexing times out.

Closes #7522
2014-09-01 12:04:24 +02:00
Britta Weber 3f0288fc59 fix typo in class name 2014-09-01 11:43:52 +02:00
Britta Weber c5ff70bf43 function_score: add optional weight parameter per function
Weights can be defined per function like this:

```
"function_score": {
    "functions": [
        {
            "filter": {},
            "FUNCTION": {},
            "weight": number
        }
        ...
```
If `weight` is given without `FUNCTION` then `weight` behaves like `boost_factor`.
This commit deprecates `boost_factor`.

The following is valid:

```
POST testidx/_search
{
  "query": {
    "function_score": {
      "weight": 2
    }
  }
}
POST testidx/_search
{
  "query": {
    "function_score": {
      "functions": [
        {
          "weight": 2
        },
        ...
      ]
    }
  }
}
POST testidx/_search
{
  "query": {
    "function_score": {
      "functions": [
        {
          "FUNCTION": {},
          "weight": 2
        },
        ...
      ]
    }
  }
}
POST testidx/_search
{
  "query": {
    "function_score": {
      "functions": [
        {
          "filter": {},
          "weight": 2
        },
        ...
      ]
    }
  }
}
POST testidx/_search
{
  "query": {
    "function_score": {
      "functions": [
        {
          "filter": {},
          "FUNCTION": {},
          "weight": 2
        },
        ...
      ]
    }
  }
}
```

The following is not valid:

```
POST testidx/_search
{
  "query": {
    "function_score": {
      "weight": 2,
      "FUNCTION(including boost_factor)": 2
    }
  }
}

POST testidx/_search
{
  "query": {
    "function_score": {
      "functions": [
        {
          "weight": 2,
          "boost_factor": 2
        }
      ]
    }
  }
}
````

closes #6955
closes #7137
2014-09-01 11:04:40 +02:00
Britta Weber 9750375412 mappings: keep parameters in mapping for _timestamp, _index and _size even if disabled
Settings that are not default for _size, _index and _timestamp were only build in
toXContent if these fields were actually enabled.
_timestamp, _index and _size can be dynamically enabled or disabled.
Therfore the settings must be kept, even if the field is disabled.
(Dynamic enabling/disabling was intended, see TimestampFieldMapper.merge(..)
and SizeMappingTests#testThatDisablingWorksWhenMerging
but actually never worked, see below).

To avoid that _timestamp is overwritten by a default mapping
this commit also adds a check to mapping merging if the type is already
in the mapping. In this case the default is not applied anymore.
(see
SimpleTimestampTests#testThatUpdatingMappingShouldNotRemoveTimestampConfiguration)

As a side effect, this fixes
- overwriting of paramters from the _source field by default mappings
  (see DefaultSourceMappingTests).
- dynamic enabling and disabling of _timestamp and _size ()
  (see SimpleTimestampTests#testThatTimestampCanBeSwitchedOnAndOff and
  SizeMappingIntegrationTests#testThatTimestampCanBeSwitchedOnAndOff )

Tests:

Enable UpdateMappingOnClusterTests#test_doc_valuesInvalidMappingOnUpdate again
The missing settings in the mapping for _timestamp, _index and _size caused a the
failure: When creating a mapping which has settings other than default and the
field disabled, still empty field mappings were built from the type mappers.
When creating such a mapping, the mapping source on master and the rest of the cluster
can be out of sync for some time:

1. Master creates the index with source _timestamp:{_store:true}
   mapper classes are in a correct state but source is _timestamp:{}
2. Nodes update mapping and refresh source which then completely misses _timestamp
3. After a while source is refreshed again also on master and the _timestamp:{}
   vanishes there also.

The test UpdateMappingOnCusterTests#test_doc_valuesInvalidMappingOnUpdate failed
because the cluster state was sampled from master between 1. and 3. because the
randomized testing injected a default mapping with disabled _size and _timestamp
fields that have settings which are not default.

The test
TimestampMappingTests#testThatDisablingFieldMapperDoesNotReturnAnyUselessInfo
must be removed because it actualy expected the timestamp to remove
parameters when it was disabled.

closes #7137
2014-09-01 10:39:33 +02:00
Boaz Leskes 0e6bb1f28b [Rest] Add the cluster name to the "/" endpoint
The root endpoint returns basic information about this node, like it's name and ES version etc. The cluster name is an important information that belongs in that list.

Closes #7524
2014-09-01 10:05:11 +02:00