Commit Graph

405 Commits

Author SHA1 Message Date
Nik Everett e54c24db02 Docs tests: rename autoSense to console
Since `// AUTOSENSE` has been replaced by `// CONSOLE` we should use
the new name for the variable name.
2016-05-09 17:29:52 -04:00
Nik Everett 5b6f9abf82 Docs tests: allow any number of leading spaces
0 too!
2016-05-09 17:18:42 -04:00
Nik Everett ddc531e729 Build a plugin for testing docs
This makes it much easier to apply to other projects.

Fixes to doc tests infrastructure:
* Fix comparing lists. Was totally broken.
* Fix order of actual vs expected parameters.
* Allow multiple `// TESTRESPONSE` lines with substitutions to join
into one big list of subtitutions. This makes lets the docs look
tidier.
* Exclude build from snippet scanning
* Allow subclasses of ESRestTestCase access to the admin execution context
2016-05-09 14:07:27 -04:00
Ryan Ernst 214ce31306 Merge pull request #18196 from rjernst/build_tools_pom
Build: Add fake project to include buildSrc as normal project
2016-05-09 10:24:23 -07:00
Ryan Ernst 6094704246 Remove IDE settings as they are now pulled in through the virtual
build-tools project
2016-05-09 10:17:47 -07:00
Ryan Ernst 52cdac4256 Merge pull request #18172 from rjernst/vagrant_logging2
Tests: Delay starting progress loggers for vagrant until test is running
2016-05-09 10:16:15 -07:00
Nik Everett 2528934411 CONSOLE is the new AUTOSENSE
This makes the test generation support both while we move from
`// AUTOSENSE` to `// CONSOLE`.

Will bother #18160
2016-05-09 09:23:23 -04:00
Ryan Ernst a78cdcdbc8 Build: Add fake project to include buildSrc as normal project
This is a follow up to #18173 and includes adding pom generation to the
fake build-tools project, which is really just buildSrc, but builds
during normal builds.
2016-05-06 22:26:15 -07:00
Ryan Ernst 3d1be071c9 Merge branch 'master' into pom_gen 2016-05-06 12:56:51 -07:00
Nik Everett cb40b986d1 Allow leading `/` in AUTOSENSE path
Relates to #18160
2016-05-06 09:26:19 -04:00
Christoph Büscher e839dad978 Remove unused chechstyle_supressions line length checks
The files removed are below the 140 character line length limit.
2016-05-06 15:06:57 +02:00
Adrien Grand e88ac11633 Add back Version.V_5_0_0. #18176
This was lost whene releasing alpha2 since the version constant got renamed.
2016-05-06 12:30:22 +02:00
Ryan Ernst e16af604bf Build: Add pom generation to assemble task
In preparation for a unified release process, we need to be able to
generate the pom files independently of trying to actually publish. This
change adds back the maven-publish plugin just for that purpose. The
nexus plugin still exists for now, so that we do not break snapshots,
but that can be removed at a later time once snapshots are happenign
through the unified tools. Note I also changed the dir jars are written
into so that all our artifacts are under build/distributions.
2016-05-05 17:57:44 -07:00
Ryan Ernst 2d2b232a7d Tests: Delay starting progress loggers for vagrant until test is running
This was broken recently as part of making the vagrant tasks extend
LoggedExec. This change fixes the progress logger to not be started
until we start seeing output from vagrant.
2016-05-05 16:12:22 -07:00
Ali Beyad c4090a1841 Remove the Snapshot class in favor of using SnapshotInfo
o/e/snapshots/Snapshot and o/e/snapshots/SnapshotInfo contain the same
fields and represent the same information.  Snapshot was used to
maintain snapshot information to the snapshot repository, while
SnapshotInfo was used to represent the snapshot information as presented
through the REST layer.  This removes the Snapshot class and combines
all uses into the SnapshotInfo class.

Closes #18167
2016-05-05 16:53:13 -04:00
Nik Everett 4b1c116461 Generate and run tests from the docs
Adds infrastructure so `gradle :docs:check` will extract tests from
snippets in the documentation and execute the tests. This is included
in `gradle check` so it should happen on CI and during a normal build.

By default each `// AUTOSENSE` snippet creates a unique REST test. These
tests are executed in a random order and the cluster is wiped between
each one. If multiple snippets chain together into a test you can annotate
all snippets after the first with `// TEST[continued]` to have the
generated tests for both snippets joined.

Snippets marked as `// TESTRESPONSE` are checked against the response
of the last action.

See docs/README.asciidoc for lots more.

Closes #12583. That issue is about catching bugs in the docs during build.
This catches *some* bugs in the docs during build which is a good start.
2016-05-05 13:58:03 -04:00
Ryan Ernst 8fc51380de Tests: improve logging for vagrant to emit entire output on failure
This change makes the vagrant tasks extend LoggedExec, so that the
entire vagrant output can be dumped on failure (and completely logged
when using --info). It should help for debugging issues like #18122.
2016-05-04 17:29:23 -07:00
Ryan Ernst 946c7e47fa Merge pull request #18050 from rjernst/plugin_props_uptodate
Build: Fix plugin properties generation when version changes
2016-04-28 11:48:52 -07:00
Ryan Ernst 10f9df3921 Build: Fix plugin properties generation when version changes
This change fixes the generation of plugin properties files when the
version changes. Before, it would not regenerate, and running integTest
would fail with an incompatibile version error.
2016-04-28 11:44:48 -07:00
Ryan Ernst be239b86b6 Merge pull request #18047 from rjernst/javac_target
Build: Explicitly set target and source compatibility for javac
2016-04-28 08:30:43 -07:00
Ryan Ernst 1a321fe3ed Build: Explicitly set target and source compatibility for javac
Gradle has a "shortcut" which omits the target and source compatibility
we set when it thinks it is not necessary (eg gradle is running on the
same version as the target compat). However, the way we compile against
java 9 is to set javac to use java 9, while gradle still runs on java 8.
This change makes -source and -target explicit for now, until these
"optimizations" can be removed from gradle.

closes #18039
2016-04-28 08:14:15 -07:00
Nik Everett 1df4efccd5 Wrap settings at 140 columns
and remove the checkstyle suppressions.
2016-04-27 18:18:20 -04:00
Nik Everett 6cccd4462c Wrap Version at 140 columns
and remove its checkstyle_suppression line
2016-04-27 17:25:37 -04:00
Nik Everett 47577613cb Wrap tasks code at 140 columns
Switch something from an explicit toString to Strings.toString which
is the same thing but with more code reuse.

Also renamed a constant to be CONSTANT_CASE.
2016-04-27 17:05:09 -04:00
Nik Everett d9afb8bfd6 [test] Wrap long lines in TasksIT 2016-04-27 15:32:56 -04:00
Jim Ferenczi 573c4f3ed1 Extend field stats:
* Add isSearchable and isAggregatable (collapsed to true if any of the instances of that field are searchable or aggregatable).
* Accept wildcards in field names.
* Add a section named conflicts for fields with the same name but with incompatible types (instead of throwing an exception).
2016-04-27 16:51:53 +02:00
Alexander Reelsen 486c783f08 Testing: Remove unused junit rule (#17947)
This rule was used to repeat failed tests due to binding on an already bound port. The test has been fixed
so we can get rid of this rule as well.
2016-04-26 09:53:49 +02:00
Alexander Reelsen f71eb0b888 Version: Set version to 5.0.0-alpha2 2016-04-26 09:30:26 +02:00
Adrien Grand 370af45c09 Add back range support to `ip` fields. #17777
`ip` fields currently fail range queries when either bound is inclusive. This
commit makes ranges also work in the exclusive case to be consistent with other
data types.
2016-04-22 09:58:01 +02:00
Nik Everett 9511c269c6 Remove <T> from Writeable
It isn't needed any more! Hurray!

Closes #17085
2016-04-21 11:14:00 -04:00
Nik Everett 476d57150a Remove readFrom from org.elasticsearch.search
Replace with a constructor that takes StreamInput or a static method.

In one case (ValuesSourceType) we no longer need to serialize the data
at all!

Relates to #17085
2016-04-21 08:07:28 -04:00
Boaz Leskes 7cd128b372 Extract non-transport primary logic from TransportReplicationAction #16492
Extracts all the replication logic that is done on the Primary to a separated class called ReplicationOperation. The goal
here is to make unit testing of this logic easier and in the future allow setting up tests that work directly on IndexShards
without the need for networking.

Closes #16492
2016-04-19 15:45:59 +03:00
Jim Ferenczi b4e6b63088 Apply the default operator on analyzed wildcard in simple_query_string builder:
* This is a followup from https://github.com/elastic/elasticsearch/pull/17711 where we now apply the default operator on analyzed wildcard query in query_string builder.
2016-04-15 21:56:50 +02:00
Daniel Mitterdorfer 3688629e11 Adjust line-length of transport related classes to coding standard 2016-04-15 10:12:24 +02:00
jaymode f35cfc3715 Copy checkstyle config to allow running from a jar
The checkstyle configuration files were being accessed as resources within the project and
being converted from a URL to a File by gradle. This works when the build tools project is being
referenced as a local project. However, when using the published jar the URL points to a resource
in the jar file, that URL cannot be converted to a File object and causes the build to fail.

This change copies the files into a `checkstyle` directory in the project build folder and always uses
File objects pointing to the copied files.
2016-04-14 13:33:10 -04:00
Adrien Grand d84c643f58 Use the new points API to index numeric fields. #17746
This makes all numeric fields including `date`, `ip` and `token_count` use
points instead of the inverted index as a lookup structure. This is expected
to perform worse for exact queries, but faster for range queries. It also
requires less storage.

Notes about how the change works:
 - Numeric mappers have been split into a legacy version that is essentially
   the current mapper, and a new version that uses points, eg.
   LegacyDateFieldMapper and DateFieldMapper.
 - Since new and old fields have the same names, the decision about which one
   to use is made based on the index creation version.
 - If you try to force using a legacy field on a new index or a field that uses
   points on an old index, you will get an exception.
 - IP addresses now support IPv6 via Lucene's InetAddressPoint and store them
   in SORTED_SET doc values using the same encoding (fixed length of 16 bytes
   and sortable).
 - The internal MappedFieldType that is stored by the new mappers does not have
   any of the points-related properties set. Instead, it keeps setting the index
   options when parsing the `index` property of mappings and does
   `if (fieldType.indexOptions() != IndexOptions.NONE) { // add point field }`
   when parsing documents.

Known issues that won't fix:
 - You can't use numeric fields in significant terms aggregations anymore since
   this requires document frequencies, which points do not record.
 - Term queries on numeric fields will now return constant scores instead of
   giving better scores to the rare values.

Known issues that we could work around (in follow-up PRs, this one is too large
already):
 - Range queries on `ip` addresses only work if both the lower and upper bounds
   are inclusive (exclusive bounds are not exposed in Lucene). We could either
   decide to implement it, or drop range support entirely and tell users to
   query subnets using the CIDR notation instead.
 - Since IP addresses now use a different representation for doc values,
   aggregations will fail when running a terms aggregation on an ip field on a
   list of indices that contains both pre-5.0 and 5.0 indices.
 - The ip range aggregation does not work on the new ip field. We need to either
   implement range aggs for SORTED_SET doc values or drop support for ip ranges
   and tell users to use filters instead. #17700

Closes #16751
Closes #17007
Closes #11513
2016-04-14 17:56:23 +02:00
Ali Beyad b87fd54ba9 Improvements to the IndicesService class
This commit contains the following improvements/fixes:
  1. Renaming method names and variables to better reflect the purpose
of the method and the semantics of the variable.
  2. For deleting indexes, replace the closed parameter passed to the
delete index/store methods with obtaining the index's state from the
IndexSettings that is already passed in.
  3. Added tests to the IndexWithShadowReplicaIT suite, some of which
show issues in the shadow replica delete process that are captured in
Github issue 17695.

Closes #17638
2016-04-14 11:14:02 -04:00
Nik Everett eb71918878 Add SearchAfter's validation back to the setter
It was part of the serialization but I removed it to convert to
writeGenericValue.
2016-04-14 10:31:35 -04:00
Nik Everett f1ad5254e4 Switch SearchAfterBuilder to writeGenericValue
and remove its PROTOTYPE.

Relates to #17085
2016-04-14 10:31:27 -04:00
Nik Everett 1c5449fe1a Remove PROTOTYPE from scripted_metric aggregation
and cut it to registerAggregation.

Relates to #17085
2016-04-14 10:05:26 -04:00
Jason Tedor 2d1ec2ee9d Remove unused import from NodeInfo.groovy 2016-04-13 20:49:35 -04:00
Jason Tedor 6133214b27 Pass test JVM arguments to test nodes
This commit passes test JVM arguments (from the system property
tests.jvm.argline) through to the test nodes that are spun up for
integration tests.
2016-04-13 20:48:41 -04:00
Nik Everett bf2483e4b3 Setup jvm opts correctly for deb tests
Also stops warning about JAVA_OPTS when it is an empty string.
2016-04-13 11:18:19 -04:00
Jason Tedor 96456fbd91 Remove remaining uses of JAVA_OPTS
This commit removes the last remaining uses of JAVA_OPTS. Now searching
the codebase for the regex '(?<!ES_)JAVA_OPTS' only shows the uses
warning of its removal and the note about it in the migration docs.
2016-04-13 10:51:53 -04:00
Jim Ferenczi 3c355b66fe Apply the default operator on analyzed wildcard in query_string builder:
* Tokens in the same position are grouped into a SynonymQuery..
 * The default operator is applied on tokens in different positions.
 * The wildcard is applied to the terms in the last position only.
Fixes #2183
2016-04-13 15:41:29 +02:00
Adrien Grand 82849a787a Add back the Version.V_5_0_0 constant. #17688 2016-04-13 10:00:37 +02:00
Jason Tedor a581d7cca4 Merge pull request #17675 from jasontedor/java-opts
Add JVM options configuration file
2016-04-12 23:07:40 -04:00
Jason Tedor 1224cc8f7a Remove unsupported env. var from node spinup
This commit removes setting ES_GC_OPTS from NodeInfo.groovy as this
environment variable is no longer supported.
2016-04-12 22:27:28 -04:00
Boaz Leskes 5af6982338 TransportNodesListGatewayStartedShards should fall back to disk based index metadata if not found in cluster state (#17663)
When an index is recovered from disk it's metadata is imported first and the master reaches out to the nodes looking for shards of that index. Sometimes those requests reach other nodes before the cluster state is processed by them. At the moment, that situation disables the checking of the store, which requires the meta data (indices with custom path need to know where the data is). When corruption hits this means we may assign a shard to node with corrupted store, which will be caught later on but causes confusion. Instead we can try loading the meta data from disk in those cases.

Relates to #17630
2016-04-12 18:41:00 +02:00
Adrien Grand 496c7fbd84 Upgrade Lucene 6 Release
* upgrades numerics to new Point format
* updates geo api changes
  * adds GeoPointDistanceRangeQuery as XGeoPointDistanceRangeQuery
  * cuts over to ES GeoHashUtils
2016-04-11 16:50:04 -05:00
Nik Everett 56f061b0b4 Replace protected setter with protected member
It is more groovy? It is easier to read at least.
2016-04-11 17:39:12 -04:00
Nik Everett 5968c4d9d1 Fix UP-TO-DATE check for some tasks
* third party audit
* jar hell
* properties file write in buildSrc
* license headers
2016-04-11 17:29:33 -04:00
Jim Ferenczi 2713a08fb3 Merge pull request #17613 from jimferenczi/all_field
Simplify AllEntries, AllField and AllFieldMapper
2016-04-11 12:13:48 +02:00
Jason Tedor 29278f8482 Output JAVA_HOME during builds
This commit enhances the build logging output to also output JAVA_HOME
(and, if applicable, org.gradle.java.home).

Closes #17629
2016-04-08 14:52:48 -04:00
Jim Ferenczi c565718ae6 Simplify AllEntries, AllField and AllFieldMapper:
* Create one AllField field per field eligible for _all.
  * Add a positionIncrementGap (with a size of 100, not configurable) between
  each entry in order to distinguish fields when doing phrase query on _all.
2016-04-08 10:58:58 +02:00
Nik Everett 16c12afabe Rework ScoreFunctionBuilder registration to remove PROTOTYPEs
This removes PROTOTYPEs from ScoreFunctionsBuilders. To do so we rework
registration so it doesn't need PROTOTYPEs and lines up with the recent
changes to query registration.
2016-04-06 13:04:11 -04:00
Luca Cavanna 67ccfc354e Switch to using ParseField to parse query names
* [TEST] check registered queries one by one in SearchModuleTests

* Switch to using ParseField to parse query names

If we have a deprecated query name, at the moment we don't have a way to log any deprecation warning nor fail when we are in strict mode. With this change we use ParseField, which will take care of the camel casing that we currently do manually (so that one day we can remove it more easily). This also means, that each query will have a unique preferred name, and all the other names are deprecated.

Terms query "in" synonym is now formally deprecated, as well as fuzzy_match, match_fuzzy, match_phrase and match_phrase_prefix for match query, mlt for more_like_this and geo_bbox for geo_bounding_box. All these will be removed in 6.0.

Every QueryParser holds now a ParseField constant called QUERY_NAME_FIELD that holds the name for it. The first name is the preferred one, all the others are deprecated. The first name is taken from the NAME constant already present in each query builder object, so that we somehow keep the serialization constant separated from ParseField. This change also allowed us to remove the names method from the QueryParser interface.
2016-04-05 15:38:53 +02:00
Tanguy Leroux dea12d200d Gradle: wraps command line arguments
So that they are resolved at execution time, not configuration time
2016-04-04 18:28:42 +02:00
Tanguy Leroux c739d9af2b Command line arguments with comma must be quoted on windows 2016-04-01 14:44:13 +02:00
Nik Everett c7780e6e0a Use ObjectParser in highlighting 2016-03-31 10:34:26 -04:00
Nik Everett f8a67a2622 Remove PROTOTYPEs from ingest 2016-03-31 09:09:35 -04:00
Simon Willnauer 81801451ad Factor out slow logs into Search and IndexingOperationListeners
This commit introduces SearchOperationListeneres which allow to hook
into search operation lifecycle and execute operations like slow-logs
and statistic collection in a transparent way. SearchOperationListenrs
can be registered on the IndexModule just like IndexingOperationListeners.
The main consumers (slow log) have already been moved out of IndexService
into IndexModule which reduces the dependency on IndexService as well as
IndexShard and makes slowlogging transparent.

Closes #17398
2016-03-30 14:38:37 +02:00
Simon Willnauer 8b075dbb75 Remove ability to specify arbitrary node attributes with `node.` prefix
Today the basic node settings like `node.data` and `node.master` can't really be fully validated
since we allow to specify custom user attributes on the node level. We have to, in order to
support that, add a wildcard setting for `node.*` to let these setting pass validation.
Instead we should require a more contraint prefix like `node.attr.` that defines a namespace
that is reserved for user attributes.
This commit adds a new namespace for attributes in `node.attr`.

Closes #17280
2016-03-30 13:29:48 +02:00
Nik Everett df08854c60 Remove PROTOTYPEs from suggesters
Also stops using guice for suggesters at all and lots of checkstyle.
2016-03-29 17:55:01 -04:00
Nik Everett 101a32573c Don't try to use system jna for naming conventions
When we test we add `-Djna.nosys=true` to the system properties but
we don't add it to system properties when running the naming conventions
test. This was causing the build to fail on a newly minted Ubuntu 15.10
machine, presumably because I made the mistake of installing maven using
the system package manager.
2016-03-29 17:52:23 -04:00
javanna 8ca4fde9f2 remove checkstyle suppression for TransportClientNodesServiceTests 2016-03-29 18:36:31 +02:00
javanna de5cbda8e7 Merge branch 'master' into enhancement/remove_node_client_setting 2016-03-29 10:48:47 +02:00
Lee Hinman 80ab366de4 Add API to explain why a shard is or isn't assigned
This adds a new `/_cluster/allocation/explain` API that explains why a
shard can or cannot be allocated to nodes in the cluster. Additionally,
it will show where the master *desires* to put the shard, according to
the `ShardsAllocator`.

It looks like this:

```
GET /_cluster/allocation/explain?pretty
{
  "index": "only-foo",
  "shard": 0,
  "primary": false
}
```

Though, you can optionally send an empty body, which means "explain the
allocation for the first unassigned shard you find".

The output when a shard is unassigned looks like this:

```
{
  "shard" : {
    "index" : "only-foo",
    "index_uuid" : "KnW0-zELRs6PK84l0r38ZA",
    "id" : 0,
    "primary" : false
  },
  "assigned" : false,
  "unassigned_info" : {
    "reason" : "INDEX_CREATED",
    "at" : "2016-03-22T20:04:23.620Z"
  },
  "nodes" : {
    "V-Spi0AyRZ6ZvKbaI3691w" : {
      "node_name" : "Susan Storm",
      "node_attributes" : {
        "bar" : "baz"
      },
      "final_decision" : "NO",
      "weight" : 0.06666675,
      "decisions" : [ {
        "decider" : "filter",
        "decision" : "NO",
        "explanation" : "node does not match index include filters [foo:\"bar\"]"
      } ]
    },
    "Qc6VL8c5RWaw1qXZ0Rg57g" : {
      "node_name" : "Slipstream",
      "node_attributes" : {
        "bar" : "baz",
        "foo" : "bar"
      },
      "final_decision" : "NO",
      "weight" : -1.3833332,
      "decisions" : [ {
        "decider" : "same_shard",
        "decision" : "NO",
        "explanation" : "the shard cannot be allocated on the same node id [Qc6VL8c5RWaw1qXZ0Rg57g] on which it already exists"
      } ]
    },
    "PzdyMZGXQdGhqTJHF_hGgA" : {
      "node_name" : "The Symbiote",
      "node_attributes" : { },
      "final_decision" : "NO",
      "weight" : 2.3166666,
      "decisions" : [ {
        "decider" : "filter",
        "decision" : "NO",
        "explanation" : "node does not match index include filters [foo:\"bar\"]"
      } ]
    }
  }
}
```

And when the shard *is* assigned, the output looks like:

```
{
  "shard" : {
    "index" : "only-foo",
    "index_uuid" : "KnW0-zELRs6PK84l0r38ZA",
    "id" : 0,
    "primary" : true
  },
  "assigned" : true,
  "assigned_node_id" : "Qc6VL8c5RWaw1qXZ0Rg57g",
  "nodes" : {
    "V-Spi0AyRZ6ZvKbaI3691w" : {
      "node_name" : "Susan Storm",
      "node_attributes" : {
        "bar" : "baz"
      },
      "final_decision" : "NO",
      "weight" : 1.4499999,
      "decisions" : [ {
        "decider" : "filter",
        "decision" : "NO",
        "explanation" : "node does not match index include filters [foo:\"bar\"]"
      } ]
    },
    "Qc6VL8c5RWaw1qXZ0Rg57g" : {
      "node_name" : "Slipstream",
      "node_attributes" : {
        "bar" : "baz",
        "foo" : "bar"
      },
      "final_decision" : "CURRENTLY_ASSIGNED",
      "weight" : 0.0,
      "decisions" : [ {
        "decider" : "same_shard",
        "decision" : "NO",
        "explanation" : "the shard cannot be allocated on the same node id [Qc6VL8c5RWaw1qXZ0Rg57g] on which it already exists"
      } ]
    },
    "PzdyMZGXQdGhqTJHF_hGgA" : {
      "node_name" : "The Symbiote",
      "node_attributes" : { },
      "final_decision" : "NO",
      "weight" : 3.6999998,
      "decisions" : [ {
        "decider" : "filter",
        "decision" : "NO",
        "explanation" : "node does not match index include filters [foo:\"bar\"]"
      } ]
    }
  }
}
```

Only "NO" decisions are returned by default, but all decisions can be
shown by specifying the `?include_yes_decisions=true` parameter in the
request.

Resolves #14593
2016-03-28 15:21:02 -06:00
Nik Everett 9402251eaf Remove PROTOTYPE from ShapeBuilders
Also cuts lots of tests over to expectThrows and fixes DistanceUnit's
serialization.
2016-03-26 13:58:33 -04:00
javanna d1b935fca5 fixed silly typo in check_style suppression file 2016-03-25 20:21:44 +01:00
javanna 93ce36a198 separated attributes from node roles in DiscoveryNode
Node roles are now serialized as well, they are not part of the node attributes anymore. DiscoveryNodeService takes care of dividing settings into attributes and roles. DiscoveryNode always requires to pass in attributes and roles separately.
2016-03-25 20:14:27 +01:00
Nik Everett 93ab4cfc99 Stop using PROTOTYPE in NamedWriteableRegistry
readFrom is confusing because it requires an instance of the type that it
is reading but it doesn't modify it. But we also have (deprecated) methods
named readFrom that *do* modify the instance. The "right" way to implement
the non-modifying readFrom is to delegate to a constructor that takes a
StreamInput so that the read object can be immutable. Now that we have
`@FunctionalInterface`s it is fairly easy to register things by referring
directly to the constructor.

This change modifying NamedWriteableRegistry so that it does that. It keeps
supporting `registerPrototype` which registers objects to be read by
readFrom but deprecates it and delegates it to a new `register` method
that allows passing a simple functional interface. It also cuts Task.Status
subclasses over to using that method.

The start of #17085
2016-03-24 11:26:44 -04:00
Jason Tedor 84a308db80 Fix line-length issues in YamlSettingsLoaderTests
This commit fixes a line-length checkstyle violation in
YamlSettingsLoaderTests.java and removes this file from the checkstyle
line-length suppressions.
2016-03-24 10:14:04 -04:00
Jason Tedor 7841b439ec Fix line-length issue in JsonSettingsLoaderTests
This commit fixes a line-length checkstyle violation in
JsonSettingsLoaderTests.java and removes this file from the checkstyle
line-length suppressions.
2016-03-24 10:14:03 -04:00
Jason Tedor cf92151513 Fix line-length issue in PropertiesSettingsLoader
This commit fixes a line-length checkstyle violation in
PropertiesSettingsLoader.java and removes this file from the checkstyle
line-length suppressions.
2016-03-24 09:47:01 -04:00
Jim Ferenczi da42f199bd Enforce isolated mode for all plugins
This commit removes the isolated option, each plugin have its own classloader.
2016-03-24 09:17:33 +01:00
Alexander Reelsen b2573858b6 Version: Set version to 5.0.0-alpha1
Change version, required a minor fix in the RPM building.
In case of a alpha/beta version, the release will contain alpha/beta
as the RPM version cannot contains dashes/tildes.
2016-03-24 08:36:08 +01:00
Jason Tedor 17dd60dd31 Merge pull request #17208 from jasontedor/install-plugin-permissions
Install plugin permissions
2016-03-23 18:44:47 -04:00
Simon Willnauer 68d07fc01f Archive cluster level settings if unknown or broken
We already archive index level settings if we find an unknown or invalid/broken
value for a setting on node startup. The same could potentially happen for persistent
cluster level settings if we remove a setting or if we add validation to a setting that
didn't exist in the past. To ensure that only valid settings are recovered into the cluster
state we archive them (prefix them with `archive.` and log a warning. Tools that check the
cluster settings can then warn users that they have broken settings in their clusterstate that
got archived.
2016-03-22 16:17:06 +01:00
Simon Willnauer 75d5b83367 Improve error message if resource files have illegal encoding
This commit fixes string formatting issues in the error handling and
provides a bettter error message if malformed input is detected.
This commit also adds tests for both situations.

Relates to #17212
2016-03-22 13:29:07 +01:00
Simon Willnauer 33521fc27c Detach IndexShard from node services
this is the last step to remove node level service from IndexShard.
This means that tests can now more easily create an IndexShard instance
without starting a node and removes the dependency between IndexShard and Client/ScriptService
2016-03-22 11:02:04 +01:00
Simon Willnauer 8127a06b2e Recover broken IndexMetaData as closed
Today if something is wrong with the IndexMetaData we detect it very
late and most of the time if that happens we already allocated the index
and get endless loops and full log files on data-nodes. This change tries
to verify IndexService creattion during initial state recovery on the master
and if the recovery fails the index is imported as `closed` and won't be allocated
at all.

Closes #17187
2016-03-21 22:50:58 +01:00
Boaz Leskes 2d1152ebac Remove ClusterService interface, in favor of it's only production instance #17183
We current have a ClusterService interface, implemented by InternalClusterService and a couple of test classes. Since the decoupling of the transport service and the cluster service, one can construct a ClusterService fairly easily, so we don't need this extra indirection.

Closes #17183
2016-03-21 13:55:10 +01:00
Martijn van Groningen e3b7e5d75a percolator: Replace percolate api with the new percolator query
Also replaced the PercolatorQueryRegistry with the new PercolatorQueryCache.

The PercolatorFieldMapper stores the rewritten form of each percolator query's xcontext
in a binary doc values field. This make sure that the query rewrite happens only during
indexing (some queries for example fetch shapes, terms in remote indices) and
the speed up the loading of the queries in the percolator query cache.

Because the percolator now works inside the search infrastructure a number of features
(sorting fields, pagination, fetch features) are available out of the box.

The following feature requests are automatically implemented via this refactoring:

Closes #10741
Closes #7297
Closes #13176
Closes #13978
Closes #11264
Closes #10741
Closes #4317
2016-03-21 12:21:50 +01:00
Jason Tedor 4fad18d3bc Fix line-length violations in InstallPluginCommand
This commit fixes the line-length checkstyle violations in
InstallPluginCommand.java and removes this from the list of files for
which the line-length check is suppressed.
2016-03-20 21:52:21 -04:00
Ryan Ernst f71f0d6010 Revert "Build: Switch to maven-publish plugin"
This reverts commit a90a2b34fc.
2016-03-18 17:22:25 -07:00
Ryan Ernst 6af4c43c4f Merge pull request #17128 from rjernst/maven_publish
Build: Switch to maven-publish plugin
2016-03-17 11:53:50 -07:00
Simon Willnauer e91a141233 Prevent index level setting from being configured on a node level
Today we allow to set all kinds of index level settings on the node level which
is error prone and difficult to get right in a consistent manner.
For instance if some analyzers are setup in a yaml config file some nodes might
not have these analyzers and then index creation fails.

Nevertheless, this change allows some selected settings to be specified on a node level
for instance:
 * `index.codec` which is used in a hot/cold node architecture and it's value is really per node or per index
 * `index.store.fs.fs_lock` which is also dependent on the filesystem a node uses

All other index level setting must be specified on the index level. For existing clusters the index must be closed
and all settings must be updated via the API on each of the indices.

Closes #16799
2016-03-17 14:42:18 +01:00
Nik Everett 80f638b56a Support scheduled commands in current context
Adds support for scheduling commands to run at a later time on another
thread pool in the current thread's context:

```java
Runnable someCommand = () -> {System.err.println("Demo");};
someCommand = threadPool.getThreadContext().preserveContext(someCommand);
threadPool.schedule(timeValueMinutes(1), Names.GENERAL, someCommand);
```

This happens automatically for calls to `threadPool.execute` but `schedule`
and `scheduleWithFixedDelay` don't do that, presumably because scheduled
tasks are usually context-less. Rather than preserve the current context
on all scheduled tasks this just makes it possible to preserve it using
the syntax above.

To make this all go it moves the Runnables that wrap the commands from
EsThreadPoolExecutor into ThreadContext.

This, or something like it, is required to support reindex throttling.
2016-03-16 12:29:06 -04:00
Christoph Büscher 39667b5793 Merge branch 'master' into feature-suggest-refactoring
Conflicts:
	docs/reference/migration/migrate_5_0/java.asciidoc
2016-03-16 12:06:42 +01:00
Ryan Ernst a90a2b34fc Build: Switch to maven-publish plugin
The build currently uses the old maven support in gradle. This commit
switches to use the newer maven-publish plugin. This will allow future
changes, for example, easily publishing to artifactory.

An additional part of this change makes publishing of build-tools part
of the normal publishing, instead of requiring a separate upload step
from within buildSrc. That also sets us up for a follow up to enable
precomit checks on the buildSrc code itself.
2016-03-15 19:16:37 -07:00
Jason Tedor 618441aea3 Merge pull request #17088 from jasontedor/simplify-bootstrap-settings
Bootstrap does not set system properties
2016-03-15 19:25:16 -04:00
Jason Tedor 66ba044ec5 Use setting in integration test cluster config 2016-03-15 17:45:17 -04:00
Yannick Welsch e91fd09692 Enable jdk-system-out Forbidden API checks on test sources 2016-03-15 15:03:37 +01:00
Christoph Büscher b4b874f0d8 Merge branch 'master' into feature-suggest-refactoring 2016-03-15 12:11:39 +01:00
Simon Willnauer bd96075f7f Merge branch 'master' into add_backwards_rest_tests 2016-03-14 21:18:42 +01:00
Simon Willnauer ce6ec511b9 Move shared directory under build/cluster/shared to prevent granting r/w permission to the build/cluster directory 2016-03-14 21:16:44 +01:00
Christoph Büscher 97638c95fc Merge branch 'master' into feature-suggest-refactoring
Conflicts:
	docs/reference/migration/migrate_5_0.asciidoc
2016-03-14 11:13:47 +01:00
Adrien Grand 5596e31068 Upgrade to lucene-6.0.0-f0aa4fc. #17075 2016-03-14 07:58:52 +01:00
Jason Tedor 8a05c2a2be Bootstrap does not set system properties
Today, certain bootstrap properties are set and read via system
properties. This action-at-distance way of managing these properties is
rather confusing, and completely unnecessary. But another problem exists
with setting these as system properties. Namely, these system properties
are interpreted as Elasticsearch settings, not all of which are
registered. This leads to Elasticsearch failing to startup if any of
these special properties are set. Instead, these properties should be
kept as local as possible, and passed around as method parameters where
needed. This eliminates the action-at-distance way of handling these
properties, and eliminates the need to register these non-setting
properties. This commit does exactly that.

Additionally, today we use the "-D" command line flag to set the
properties, but this is confusing because "-D" is a special flag to the
JVM for setting system properties. This creates confusion because some
"-D" properties should be passed via arguments to the JVM (so via
ES_JAVA_OPTS), and some should be passed as arguments to
Elasticsearch. This commit changes the "-D" flag for Elasticsearch
settings to "-E".
2016-03-13 20:09:15 -04:00