Commit Graph

6755 Commits

Author SHA1 Message Date
Robert Muir 2ed711fc6f mark just this method as @Slow, can easily take over a minute 2015-04-19 15:09:16 -04:00
Robert Muir b09d236fc0 run tests with AssertingCodec to find bugs 2015-04-19 13:56:12 -04:00
Ryan Ernst 68f75ea7b6 simplified rest skip range version parsing more, ranges can now be open
ended
2015-04-19 06:50:08 -07:00
Robert Muir 9e0a9588e8 add more paranoia to PathUtils 2015-04-19 09:21:45 -04:00
Ryan Ernst 22af0e627c cleanup order of before/after stuff, reorganize helper methods a bit 2015-04-18 18:17:13 -07:00
Robert Muir b728772fe4 more fine-grained @slow tuning, remove from many tests that got unlucky with fsync 2015-04-18 19:59:29 -04:00
Ryan Ernst 137875513e remove fixed seed for version util tests 2015-04-18 13:28:17 -07:00
Ryan Ernst b46df4d5dc suppress extrasfs from integ tests, fix bug in random version util 2015-04-18 13:25:00 -07:00
Ryan Ernst 06eee11dbb simplify version handling in rest tests, add tests for version utilities 2015-04-18 12:48:00 -07:00
Robert Muir d301567ecf let tests.verbose tell the story 2015-04-18 13:48:33 -04:00
Ryan Ernst ce6b3774ec move version related stuff to dedicated test utility 2015-04-18 03:00:45 -07:00
Ryan Ernst d8a92947d1 removed some esoteric helper functions, shuffled methods around in base class 2015-04-18 01:53:22 -07:00
Ryan Ernst e91a7de9f7 move rest and integration test annotations and sysprops to their respective tests 2015-04-18 01:00:45 -07:00
Robert Muir d2854d7267 mark slow tests with @Slow annotation 2015-04-18 02:23:05 -04:00
Ryan Ernst b27c7f0d2a suppress extrasfs from corrupted file test 2015-04-17 21:09:36 -07:00
Ryan Ernst 310e04bdb3 Merge branch 'mockfilesystem' of github.com:elastic/elasticsearch into mockfilesystem 2015-04-17 20:53:46 -07:00
Ryan Ernst e4de0cb57f removed jvm ordinal constant, only really needed now for test cluster
port numbering (moved to there)
2015-04-17 20:52:38 -07:00
Robert Muir c7ce72733d disable extras for this test 2015-04-17 23:52:28 -04:00
Robert Muir 96f08a38e6 parallelize rest tests 2015-04-17 23:38:01 -04:00
Ryan Ernst 621f502b12 move bwc specific stuff to backcompat base class 2015-04-17 18:48:34 -07:00
Robert Muir 52c4af6115 remove these helpers 2015-04-17 21:22:57 -04:00
Robert Muir a312098785 nuke duplicate methods 2015-04-17 21:09:53 -04:00
Robert Muir 61b60da7d2 nuke some unused stuff 2015-04-17 21:02:05 -04:00
Robert Muir aa381a2775 fold ESTestCase into ElasticsearchTestCase 2015-04-17 20:35:28 -04:00
Robert Muir 84811a57d6 nuke ElasticsearchSingleNodeLuceneTestCase 2015-04-17 20:19:32 -04:00
Robert Muir 0ff0a0082d fix backwards test to not muck with URIs or get mad about extra clusters 2015-04-17 19:41:55 -04:00
Robert Muir 43b6cd2118 Merge branch 'master' into mockfilesystem 2015-04-17 19:15:25 -04:00
Robert Muir e71553556e remove tests.processors, this is a reproducibility nightmare 2015-04-17 18:32:52 -04:00
Robert Muir c7c4045e19 speed up directory wrapping 2015-04-17 17:12:55 -04:00
Julie Tibshirani dc1742785d Mappings: Fixed an equality check in StringFieldMapper.
The check was ineffective and was causing search_quote_analyzer to be added to the mapping unnecessarily.

Closes #10357
closes #10359
2015-04-17 13:18:53 -07:00
Michael McCandless fdc7db7b11 Test back compat of 0.90.6 index
Add back UpgradeReallyOldIndexTest from 1.x, but test 0.90.6 index
(Lucene 4.x) instead of 0.20 (Lucene 3.x), and make sure
only_ancient_segments works.

Closes #10639
2015-04-17 14:02:53 -04:00
Robert Muir a985c972f2 suppress all filesystems here due to jimfs brokenness 2015-04-17 12:28:29 -04:00
Robert Muir b113fbd283 fix nocommits 2015-04-17 11:57:45 -04:00
Robert Muir 57b5e06dd6 disable extras for test, clean up some stragglers 2015-04-17 11:35:20 -04:00
Robert Muir d08322e000 disable WindowsFS for this test. unsure if its a problem on real windows too 2015-04-17 09:21:54 -04:00
Robert Muir 2d9e5b4807 fix FileSystemUtils failures 2015-04-17 08:26:25 -04:00
Robert Muir c421948300 upgrade to lucene 5.2 r1674278 2015-04-17 07:58:20 -04:00
Robert Muir 89b9f0e541 Merge branch 'master' into mockfilesystem 2015-04-17 07:55:48 -04:00
Martijn van Groningen 161e74029f Core: Fix NPE. The `future` field is set from a different thread.
Closes #10630
2015-04-17 10:46:22 +02:00
Adrien Grand fd416d5ed5 Upgrade to Lucene-5.2-snapshot-1674183. 2015-04-17 10:05:30 +02:00
Simon Willnauer 630544cc69 [TEST] Use lowercase index names in test 2015-04-17 08:34:51 +02:00
Robert Muir 007e8f1d5c remove redundant confusing output 2015-04-17 02:05:59 -04:00
Robert Muir 65367f5efa fix many test bugs by minimizing URI handling 2015-04-16 21:24:07 -04:00
Ryan Ernst 84b20c0e0e revert change to use .getPath(), it doens't work on windows 2015-04-16 16:05:06 -07:00
Robert Muir 370819a98a Merge branch 'master' into mockfilesystem 2015-04-16 18:26:12 -04:00
Simon Willnauer 5f9bac435e [TEST] mute test and remove once #10638 is in 2015-04-16 22:56:52 +02:00
Robert Muir 8ceb495007 improve REPRODUCE WITH 2015-04-16 09:56:56 -04:00
Simon Willnauer 4fccb48ae8 [TEST] Wait for green after restore indices 2015-04-16 14:10:36 +02:00
Michael McCandless 399f0ccce9 Core: add only_ancient_segments to upgrade API, so only segments with an old Lucene version are upgraded
This option defaults to false, because it is also important to upgrade
the "merely old" segments since many Lucene improvements happen within
minor releases.

But you can pass true to do the minimal work necessary to upgrade to
the next major Elasticsearch release.

The HTTP GET upgrade request now also breaks out how many bytes of
ancient segments need upgrading.

Closes #10213

Closes #10540

Conflicts:
	dev-tools/create_bwc_index.py
	rest-api-spec/api/indices.upgrade.json
	src/main/java/org/elasticsearch/action/admin/indices/optimize/OptimizeRequest.java
	src/main/java/org/elasticsearch/action/admin/indices/optimize/ShardOptimizeRequest.java
	src/main/java/org/elasticsearch/action/admin/indices/optimize/TransportOptimizeAction.java
	src/main/java/org/elasticsearch/index/engine/InternalEngine.java
	src/test/java/org/elasticsearch/bwcompat/StaticIndexBackwardCompatibilityTest.java
	src/test/java/org/elasticsearch/index/engine/InternalEngineTests.java
	src/test/java/org/elasticsearch/rest/action/admin/indices/upgrade/UpgradeReallyOldIndexTest.java
2015-04-16 05:24:33 -04:00
Adrien Grand 563e704881 Mappings: Same code path for dynamic mappings updates and updates coming from the API.
We have two completely different code paths for mappings updates, depending on
whether they come from the API or are guessed based on the parsed documents.
This commit makes dynamic mappings updates execute like updates from the API.

The only change in behaviour is that a document that fails parsing can not
modify mappings anymore (useful to prevent issues such as #9851). Other than
that, this change should be fairly transparent to users but working this way
opens doors to other changes such as validating dynamic mappings updates on the
master node (#8688).

The way it works internally is that Mapper.parse now returns a Mapper instead
of being void. The returned Mapper represents a mapping update that has been
performed in order to parse the document. Mappings updates are propagated
recursively back to the root mapper, and once parsing is finished, we check
that the mappings update can be applied, and either fail the parsing if the
update cannot be merged (eg. because of a concurrent mapping update from the
API) or merge the update into the mappings.

However not all mappings updates can be applied recursively, `copy_to` for
instance can add mappings at totally different places in the tree. Because of
it I added ParseContext.rootMapperUpdates which `copy_to` fills when the
field to copy data to does not exist in the mappings yet. These mappings
updates are merged from the ones generated by regular parsing.

One particular mapping update was the `auto_boost` setting on the `all` root
mapper. Being tricky to work on, I removed it in favour of search-time checks
that payloads have been indexed.

One interesting side-effect of the change is that concurrency on ObjectMapper
is greatly simplified since we do not have to care anymore about having
concurrent dynamic mappings and API updates.
2015-04-16 10:16:59 +02:00
Ryan Ernst 93e591c5fa Enabled mockfs on base test class. All tests pass. Added suppressions
with nocommits for tests that need to be investigated.
2015-04-16 00:25:02 -07:00
Ryan Ernst 4d44fa0192 Fixed test using .getURI() for resource paths to use .getPath() instead. We should probalby ban .getURI()?
Also added a couple nocommits for some issues with tests after mockfs is
working again. But I also re-enabled the mockfs suppression in the base
test case for now.
2015-04-15 23:09:21 -07:00
Robert Muir e5a699fa05 cutover to lucenetestcase 2015-04-16 00:58:02 -04:00
Robert Muir 401452608e ensure security manager is always on if it should be 2015-04-15 21:20:13 -04:00
Robert Muir fb481bc145 Merge branch 'master' into mockfilesystem
Conflicts:
	src/main/java/org/elasticsearch/index/translog/Translog.java
	src/main/java/org/elasticsearch/index/translog/fs/FsTranslog.java
2015-04-15 18:34:24 -04:00
Robert Muir 6ac4d6daef contain filesystem access 2015-04-15 18:23:30 -04:00
Lee Hinman 4f8ea78356 [TEST] Supress filesystems for base test classes 2015-04-15 15:49:56 -06:00
Lee Hinman 2d768bb3e8 [TEST] Fix ShadowEngineTests writing to CWD
After #a3f0789 these tests fail because the translog getPath returns a
path that is a CWD path (even though it is unneeded)
2015-04-15 15:37:55 -06:00
Ryan Ernst a3f078985b Tests: Forbid tests from writing to CWD
Allowing tests writing to the working directory can mask problems.
For example, multiple tests running in the same jvm, and using the
same relative path, may cause issues if the first test to run
leaves data in the directory, and the second test does not remember
to cleanup the path before using it.

This change adds security manager rules to disallow tests writing
to the working directory. Instead, tests create a temp dir with
the existing test framework.

closes #10605
2015-04-15 12:45:20 -07:00
Areek Zillur c326738193 [FIX] Make GeoContext mapping idempotent
closes #10581
closes #8937
2015-04-15 12:01:24 -04:00
Boaz Leskes 3dd37c06ff Test: testTranslogReplayWithFailure didn't allow for MockDirectoryWrapper being optional 2015-04-14 20:36:32 +02:00
Alex Ksikes d339ee4005 Term Vectors: terms filtering
This adds a new feature to the Term Vectors API which allows for filtering of
terms based on their tf-idf scores. With `dfs` option on, this could be useful
for finding out a good characteric vector of a document or a set of documents.
The parameters are similar to the ones used in the MLT Query.

Closes #9561
2015-04-14 19:11:09 +02:00
Colin Goodheart-Smithe 82df50a039 Aggregations: Fix _as_string output to only show when format specified
Closes #10284
2015-04-14 16:30:18 +01:00
Adrien Grand 22720a1abd Merge pull request #10562 from jpountz/upgrade/lucene-5.2.0-snapshot-1673124
Upgrade to lucene-5.2.0-snapshot-1673124.
2015-04-14 16:57:09 +02:00
Simon Willnauer 210f6c7b33 [TRANSLOG] Remove useless random translog directory selection
Using ThreadLocalRandom only prevents reproducibilty but doesn't buy us
anything. In production different datapaths won't have the same since
anyway or at least with a low likelyhood.
2015-04-14 15:57:09 +02:00
Christoph Büscher eac922b73b Merge pull request #10592 from cbuescher/remove-matchall-norms
Remove unused normsField from MatchAllQuery
2015-04-14 13:11:05 +02:00
Christoph Büscher c169e792b5 Remove unused normsField from MatchAllQuery 2015-04-14 12:39:05 +02:00
Michael McCandless 8925615eea also log all mounts in node path summary log line; use JmxFsProbe also in non-summarized case 2015-04-14 06:22:24 -04:00
Michael McCandless 68f93e53a8 Include spins and file system type in "fs" nodes stats
Also log a one-line summary at default INFO level logging of the
spins, type for all paths in the node's path.data.

Closes #10527
2015-04-14 04:58:35 -04:00
Simon Willnauer 0fcd31b6dc [CORE] Move back to single EngineConfig
We need to preserve settings (yet transient) even though the engine is not yet
started. This commit moves back to a single EngineConfig to simplify IndexShard
and settings state.

Closes #10584
2015-04-14 10:43:23 +02:00
Simon Willnauer b756477fb4 [CORE] Rename START phase into VERIFY_INDEX
we really only optionally run checkindex in this phase and moving
the engine start into translog is move cleaner code wise.

Closes #10570
2015-04-14 09:53:02 +02:00
Simon Willnauer fe411a9295 [BUILD] Restrict read permission to project.basedir/target if security manager is used 2015-04-14 09:35:40 +02:00
Boaz Leskes 773d64c4f2 Test: mute testIndexBufferSizeUpdateAfterCreationRemoval
see #10584
2015-04-14 08:36:29 +02:00
Jun Ohtani deeea217e1 Analysis: fix ignoring tokenizer settings in SynonymTokenFilterFactory
add test for synonym with tokenizer settings
2015-04-14 08:37:04 +09:00
Robert Muir 131431aa54 nuke duplicate copy-paste in AllTermQuery 2015-04-13 18:57:02 -04:00
Shay Banon 41343eca95 Improve exception handling in transport local execution
Local execution of transport messages failures can create a more detailed remote transport exceptions. Also, when failing to handle an exception, the error should be logged, and not call the handler again with another exception
closes #10554
2015-04-13 15:45:55 -07:00
Shay Banon e2a05bb43f Cleanup JVM info and stats
Remove reflection since its not needed with Java 7, remove lastGcInfo since its not used, and move to only provide getters
closes #10553
2015-04-13 15:24:14 -07:00
Lee Hinman fcbe3f92b7 [CORE] Log sending translog operation batches to nodes 2015-04-13 14:59:32 -06:00
Alex Ksikes c347dfe91c Validate API: support for verbose explanation of succesfully validated queries
This commit adds a `rewrite` parameter to the validate API in order to shown
how the given query is re-written into primitive queries. For example, an MLT
query is re-written into a disjunction of the selected terms. Other use cases
include `fuzzy`, `common_terms`, or `match` query especially with a
`cutoff_frequency` parameter. Note that the explanation is only given for a
single randomly chosen shard only, so the output may vary from one shard to
another.

Relates #1412
Closes #10147
2015-04-13 19:17:58 +02:00
Simon Willnauer c13e604697 [BUILD] Restrict read permission to project.basedir
This prevents reads from anywhere outside of the elasticsearch
clone when running tests with security manager enabled.
2015-04-13 16:44:31 +02:00
Simon Willnauer b1c9dfc2e8 [RECOVERY] Integrate translog recovery into Engine / InternalEngine
Today the engine writes the transaction log itself as well as manages
all the commit / translog mapping internally. Yet, if an engine is closed
and reopend it doesn't replay it's translog or does anything to be consistent
with it's latest state again.
This change moves the transaction log replay code into the Engine / InternalEngine
and adds unittests for replaying and consistency.

Closes #10452
2015-04-13 16:42:45 +02:00
Colin Goodheart-Smithe 7fdf32fb0d changed `bucketsPaths` to `buckets_paths` 2015-04-13 15:13:02 +01:00
Colin Goodheart-Smithe 392f9ce1f8 clean up 2015-04-13 14:34:53 +01:00
Colin Goodheart-Smithe 306d94adb9 Revert "Added normalisation to Derivative Reducer"
This reverts commit 48a94a41df.
2015-04-13 14:24:23 +01:00
Boaz Leskes 8e302f1172 Recovery: allow to recover into a folder containing a corrupted shard
At the moment, we are very strict when handling data folders containing corrupted shards and will fail any recovery attempt into it. Typically this wouldn't be a problem as the shard will be assigned to another node (which we try first anyway when a shard fails). However, it has been proven to be too strict for smaller clusters which may not have an extra node available (either because of allocation filtering, disk space issues etc.). This commit changes the behavior to force a full recovery. Once all the new files are verified we remove the old corrupted data and start the shard.

This also fixes a small issue where the shard state file wasn't deleted on an engine failure (we had a protection against deleting the state file on an active shard, but in this case the shard is still active but will be removed). The state deletion is also moved to before the failure handlers are called, to avoid race conditions when calling the master (it will potentially try to read it when allocating the shard)

Closes #10558
2015-04-13 15:07:14 +02:00
Colin Goodheart-Smithe 48a94a41df Added normalisation to Derivative Reducer
This changes adds the ability to specify the units for the x-axis for derivative values and calculate the derivative based on those units rather than the original histograms x-axis units
2015-04-13 11:44:29 +01:00
Colin Goodheart-Smithe 7d38989cdb Merge branch 'master' into feature/aggs_2_0 2015-04-13 09:53:49 +01:00
Adrien Grand 45afa47a6f Upgrade to lucene-5.2.0-snapshot-1673124. 2015-04-13 10:43:58 +02:00
Simon Willnauer d738b3d1e2 [BUILD] Use SuppressFrobidden annotation instead of class level excludes
Forbidden APIs 1.8 allows excludes based on annotations which can now be on methods etc. for more find grained control.

Closes #10560
2015-04-13 10:08:50 +02:00
Britta Weber 4934def035 [TEST] better test start and end messages
print when cleaning up also for SingleNodeTests
distinguish between after suite and after test cleanup
2015-04-11 15:02:40 +02:00
Michael McCandless 3cc3390f17 don't return negative percentage when max < 0 2015-04-11 06:02:59 -04:00
Nicholas Knize 90e1775a2b [GEO] Correct ShapeBuilder coordinate parser to ignore values in 3rd+ dimension
ShapeBuilder's coordinate parser expected 2 double values for every coordinate array. If > 2 doubles were provided the parser terminated parsing of the coordinate array. This resulted in an invalid Shape state leaving LineStrings, LinearRings, and Polygons with a single coordinate. An incorrect parse exception was thrown. This corrects the parser to ignore those values in the 3rd+ dimension, correctly parsing the rest of the coordinate array.

Unit tests have been updated to verify the fix.

closes #10510
2015-04-10 15:33:21 -05:00
Nicholas Knize 754856289e [GEO] Add merge conflicts to GeoShapeFieldMapper
Prevents the user from changing strategies, tree, tree_level or precision. distance_error_pct changes are allowed as they do not compromise the integrity of the index. A separate issue is open for allowing users to change tree_level or precision.
2015-04-10 14:33:17 -05:00
Nicholas Knize a8a35d7c29 [GEO] Fix hole intersection at tangential coordinate
OGC SFA 2.1.10 assertion 3 allows interior boundaries to touch exterior boundaries provided they intersect at a single point. Issue #9511 provides an example where a valid shape is incorrectly interpreted as invalid (a false violation of assertion 3).  When the intersecting point appears as the first and last coordinate of the interior boundary in a polygon, the ShapeBuilder incorrectly counted this as multiple intersecting vertices. The fix required a little more than just a logic check. Passing the duplicate vertices resulted in a connected component in the edge graph causing an invalid self crossing polygon. This required additional logic to the edge assignment in order to correctly segment the connected components. Finally, an additional hole validation has been added along with proper unit tests for testing valid and invalid conditions (including dateline crossing polys).

closes #9511
2015-04-10 11:44:40 -05:00
Adrien Grand 5b3cc2f07c Search: deprecate the limit filter.
This is really a Collector instead of a filter. This commit deprecates the
`limit` filter, makes it a no-op and recommends to use the `terminate_after`
parameter instead that we introduced in the meantime.
2015-04-10 17:18:50 +02:00
Adrien Grand 919589b908 Queries: Remove fuzzy-like-this support.
The fuzzy-like-this query builds very expensive queries and only serves esoteric
use-cases.
2015-04-10 17:16:02 +02:00
Isabel Drost-Fromm 5faac37900 Fix typo in JVM checker user help.
When checking the JVM currently running ES we provide the user with
help on which environment variable to use to disable the check in
case the check fails. The variable we point to however is the wrong
one.
2015-04-10 09:42:11 +02:00
Ryan Ernst 224c43564b Tests: Add multi data path testing to static bwc tests
This randomly chooses to run bwc indexes on single or multi data paths.

closes #10519
2015-04-09 14:31:31 -07:00
Ryan Ernst 9d0764e5df Tests: increasing timeout for replicas in static bwc tests, to account
for reallySlowJenkinsWhenIndexHasLotsOfSegments
2015-04-09 13:31:08 -07:00
Michael McCandless 78612cf0a8 fix indent 2015-04-09 14:47:48 -04:00
Michael McCandless 54b702db07 Tests: don't fsync so often
Most tests don't "really" need to fsync, and this is costly (makes
tests slower, wears out our SSDs).

This change makes it uncommon to actually fsync when Lucene asks for
it.  It's just a workaround (in MockDirectoryHelper) until we can
cutover Elasticseach to use MockFileSystem like Lucene.

Closes #10516
2015-04-09 14:31:42 -04:00
Michael McCandless 2f5cbf5f9d Core: log path.data filesystem details to INFO level
This change logs total space, free space, usable free space, an
estimate of whether the IO system spins (e.g., SSD or not), the mount
point and filesystem type, on node startup.

It produces log output like this:

[2015-04-09 12:09:30,244][INFO ][env                      ] [node_t0] node data locations details:
  -> /l/es.logspins/target/J0/data/TEST-haswell-CHILD_VM=[0]-CLUSTER_SEED=[2926863498862121027]-HASH=[AFC194B1B384B]/nodes/0, free_space [260.6gb], usable_space [256.3gb], total_space [465gb], spins? [no], mount [/ (/dev/mapper/haswell--vg-root)], type [btrfs]

Closes #10502
2015-04-09 13:11:49 -04:00
Simon Willnauer d470bdbff6 Only flush for checkindex if we have uncommitted changes
Today we force a flush before check index to ensure we have an index
to check on. Yet if the index is large and the FS is slow this can have
significant impact on the index deletion performance. This commit introduces
a check if there are any uncommitted changes in order to skip the additional commit.

Closes #10505
2015-04-09 18:25:57 +02:00
javanna 5367e04fbc [TEST] add 1.5.1 index for bw comp tests 2015-04-09 17:03:35 +02:00
Colin Goodheart-Smithe 56a37620ed Merge branch 'master' into feature/aggs_2_0
Conflicts:
	src/main/java/org/elasticsearch/percolator/PercolatorService.java
	src/main/java/org/elasticsearch/search/aggregations/AggregationPhase.java
	src/main/java/org/elasticsearch/search/aggregations/InternalAggregation.java
	src/main/java/org/elasticsearch/search/aggregations/InternalAggregations.java
	src/main/java/org/elasticsearch/search/aggregations/bucket/InternalSingleBucketAggregation.java
	src/main/java/org/elasticsearch/search/aggregations/bucket/filters/InternalFilters.java
	src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/InternalGeoHashGrid.java
	src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/InternalHistogram.java
	src/main/java/org/elasticsearch/search/aggregations/bucket/range/InternalRange.java
	src/main/java/org/elasticsearch/search/aggregations/bucket/significant/GlobalOrdinalsSignificantTermsAggregator.java
	src/main/java/org/elasticsearch/search/aggregations/bucket/significant/InternalSignificantTerms.java
	src/main/java/org/elasticsearch/search/aggregations/bucket/significant/SignificantStringTermsAggregator.java
	src/main/java/org/elasticsearch/search/aggregations/bucket/significant/SignificantTermsAggregatorFactory.java
	src/main/java/org/elasticsearch/search/aggregations/bucket/significant/UnmappedSignificantTerms.java
	src/main/java/org/elasticsearch/search/aggregations/bucket/terms/GlobalOrdinalsStringTermsAggregator.java
	src/main/java/org/elasticsearch/search/aggregations/bucket/terms/InternalTerms.java
	src/main/java/org/elasticsearch/search/aggregations/bucket/terms/StringTermsAggregator.java
	src/main/java/org/elasticsearch/search/aggregations/bucket/terms/TermsAggregatorFactory.java
	src/main/java/org/elasticsearch/search/aggregations/bucket/terms/UnmappedTerms.java
	src/main/java/org/elasticsearch/search/aggregations/metrics/avg/InternalAvg.java
	src/main/java/org/elasticsearch/search/aggregations/metrics/cardinality/InternalCardinality.java
	src/main/java/org/elasticsearch/search/aggregations/metrics/geobounds/InternalGeoBounds.java
	src/main/java/org/elasticsearch/search/aggregations/metrics/max/InternalMax.java
	src/main/java/org/elasticsearch/search/aggregations/metrics/min/InternalMin.java
	src/main/java/org/elasticsearch/search/aggregations/metrics/percentiles/AbstractInternalPercentiles.java
	src/main/java/org/elasticsearch/search/aggregations/metrics/scripted/InternalScriptedMetric.java
	src/main/java/org/elasticsearch/search/aggregations/metrics/stats/InternalStats.java
	src/main/java/org/elasticsearch/search/aggregations/metrics/stats/extended/InternalExtendedStats.java
	src/main/java/org/elasticsearch/search/aggregations/metrics/sum/InternalSum.java
	src/main/java/org/elasticsearch/search/aggregations/metrics/tophits/InternalTopHits.java
	src/main/java/org/elasticsearch/search/aggregations/metrics/valuecount/InternalValueCount.java
2015-04-09 15:33:34 +01:00
javanna 4608f868bf add 1.5.2 snapshot version and and make 1.5.1 a released version 2015-04-09 16:15:05 +02:00
Colin Goodheart-Smithe fcc09f62b9 Aggregations: removed aggregations from ReduceContext
ReduceContext contains the list of aggregations to reduce but these aggregations are set as null half of the time. This change makes the reduce(ReduceContext) method changed to reduce(List<InternalAggregation>, ReduceContext) and ReduceContext now only holds the BigArrays and Script services.
2015-04-09 14:58:17 +01:00
Simon Willnauer 3b41299273 Add missing hashCode method to RecoveryState#File 2015-04-09 15:07:28 +02:00
David Pilato 88ee7a5dca Deprecate rivers
* In code, we mark `River`, `AbstractRiverComponent`, `RiverComponent` and `RiverName` classes as deprecated
* We log that information when a cluster is still using it
* We add this information in the plugins list as well
2015-04-09 14:29:16 +02:00
Colin Goodheart-Smithe e19d20b407 max bucket reducer and sibling reducer framework 2015-04-09 12:16:35 +01:00
Adrien Grand fae124103a Merge pull request #10420 from jpountz/feature/numeric_resolution
Mappings: Bring back numeric_resolution.

Close #10420
2015-04-09 12:28:33 +02:00
Adrien Grand aecd9ac515 Aggregations: Speed up include/exclude in terms aggregations with regexps.
Today we check every regular expression eagerly against every possible term.
This can be very slow if you have lots of unique terms, and even the bottleneck
if your query is selective.

This commit switches to Lucene regular expressions instead of Java (not exactly
the same syntax yet most existing regular expressions should keep working) and
uses the same logic as RegExpQuery to intersect the regular expression with the
terms dictionary. I wrote a quick benchmark (in the PR) to make sure it made
things faster and the same request that took 750ms on master now takes 74ms with
this change.

Close #7526
2015-04-09 12:12:56 +02:00
Adrien Grand 6b16b32174 Aggregations: Fix multi-level breadth-first aggregations.
The refactoring in #9544 introduced a regression that broke multi-level
aggregations using breadth-first. This was due to sub-aggregators creating
deferred collectors before their parent aggregator and then the parent
aggregator trying to collect sub aggregators directly instead of going through
the deferred wrapper.

This commit fixes the issue but we should try to simplify all the pre/post
collection logic that we have.

Also `breadth_first` is now automatically ignored if the sub aggregators need
scores (just like we ignore `execution_mode` when the value does not make sense
like using ordinals on a script).

Close #9823
2015-04-09 12:06:08 +02:00
Simon Willnauer 17c06f06ba [TEST] issue additional flush 2015-04-09 11:56:36 +02:00
Michael McCandless c9afeccac4 merged 2015-04-09 05:01:53 -04:00
Michael McCandless 9981d69e06 Core: add trace logging for the commitTranslog=false case in InternalEngine.flush 2015-04-09 05:00:40 -04:00
Simon Willnauer 953ae63d2b [TEST] beast slow index to fail with trace logging 2015-04-09 10:47:00 +02:00
Simon Willnauer a243b3f924 [LOGGING] Use static logger name in Engine.java
To ensure subclasses like MockInternalEngine which is in a different
package (test.engine) are logging under the same logger name this commit
moves to a static logger class to determin the logger name. This way
all subclasses of engine will log under `index.engine` which also plays
nicely with `@TestLogging` where log messages sometimes disappeared since
they were enabled for the `index.engine` package but not for `test.engine`
2015-04-09 10:07:50 +02:00
Ryan Ernst a5bfe332e5 Tests: increase logging for lucene commit during flush in InternalEngine 2015-04-09 00:25:05 -07:00
Ryan Ernst c821b8d3b4 Tests: remove static bwc delete index timeout, so that the slow delete
failure can repro with additional logging
2015-04-08 23:29:37 -07:00
Simon Willnauer b52d24a031 [TEST] increase logging for pulling snapshot from InternalEngine 2015-04-09 06:41:11 +02:00
Ryan Ernst b343d688c5 Tests: Increase delete timeout for static bwc tests to 1 minute 2015-04-08 21:24:36 -07:00
Ryan Ernst ab395c1267 Tests: allow up to 30s to delete indexes in old static tests
When deleting an index, the tests run checkindex, which requires a
flush.  This can be very slow on virtualized hardware..
2015-04-08 13:57:22 -07:00
Ryan Ernst 178f650552 Tests: Fix static bwc replicas at 1 2015-04-08 09:02:44 -07:00
Simon Willnauer f687377e2f [ENGINE] sync translog before closing engine
If the translog is buffered we must make sure everything is synced to disk
before we rollback the writer otherwise we open a window for potential dataloss due
to stupid errors preventing the translog from being closed.
2015-04-08 17:57:33 +02:00
Ryan Ernst 6df978e76e Test: increasing replicas timeout to avoid slowness on virtualized
hardware (aka jenkins)
2015-04-08 08:44:39 -07:00
Zachary Tong a824184bf2 Aggregations: Add MovAvg Reducer
Allows the user to calculate a Moving Average over a histogram  of buckets.  Provides four different
moving averages:
 - Simple
 - Linear weighted
 - Single Exponentially weighted (aka EWMA)
 - Double Exponentially weighted (aka Holt-winters)

Closes #10024
2015-04-08 10:20:46 -04:00
javanna acabf2d55a Cluster state REST api: print routing_nodes out only when requested through specific flag
For bacwards compatibility reasons routing_nodes were previously printed out when routing_table was requested, together with the actual routing_table. Now they are printed out only when requests through `routing_nodes` flag.

Relates to #10412
Closes #10486
2015-04-08 16:10:36 +02:00
Boaz Leskes 174d141512 Test: increase recovery concurrency in OldIndexBackwardsCompatibilityTests.testOldIndices
Also added some logging to help pin point slowness
2015-04-08 15:44:45 +02:00
Leonardo Menezes 5fd9aee16e Cluster state REST api: routing_nodes as an independent metric option
Cluster state api returns both routing_table and routing_nodes sections whenever routing_table is requested. That is pretty much the same info, just grouped differently. This commit allows to differentiate between the two. Yet, routing_table still returns both for bw comp reasons.

Closes #10352
Closes #10412
2015-04-08 15:35:11 +02:00
Colin Goodheart-Smithe caeb85ef19 Merge branch 'master' into feature/aggs_2_0 2015-04-08 14:15:50 +01:00
javanna d9aebf4906 Scripting: remove deprecated methods from ScriptService
Removed the following methods from `ScriptService`, which don't require the `ScriptContext` argument:

```
public CompiledScript compile(String lang,  String script, ScriptType scriptType)

public ExecutableScript executable(String lang, String script, ScriptType scriptType, Map<String, Object> vars)

public SearchScript search(SearchLookup lookup, String lang, String script, ScriptType scriptType, @Nullable Map<String, Object> vars)
```

Also removed the ScriptContext.Standard.GENERIC_PLUGIN enum value, as it was used only for backwards compatibility.

 Plugins that make use of scripts should declare their own script contexts through `ScriptModule#registerScriptContext` and use them when compiling/executing scripts.

Closes #10476
2015-04-08 12:20:03 +02:00
javanna 7bd7ea8f13 Scripting: allow plugins to define custom operations that they use scripts for
Plugins can now define multiple operations/contexts that they use scripts for. Fine-grained settings can then be used to enable/disable scripts based on each single registered context.

Also added a new generic category called `plugin`, which will be used as a default when the context is not specified. This allows us to restore backwards compatibility for plugins on `ScriptService` by restoring the old methods that don't require the script context and making them internally use the `plugin` context, as they can only be called from plugins.

Closes #10347
Closes #10419
2015-04-08 11:57:00 +02:00
javanna df875707ec Indexed scripts/templates: return response body when script is not found
Align get indexed scripts and get search template apis to our get api, which returns a response body when the document is not found, with a found boolean flag. Also, return metadata info all the time too.

Closes #7325
Closes #10396
2015-04-08 10:44:11 +02:00
Adrien Grand 85e4c21b0a Tests: Disable the query cache for parent/child unit tests. 2015-04-08 09:58:59 +02:00
Adrien Grand 717dbb0599 Tests: Fix bug in SimpleSortTests.
This tests adds a mappings with {"fielddata": {"format": "doc_values"}} but the
default mapping has {"doc_values": false} so when the document mapper parsing
logic merges both we have {"doc_values": false,"fielddata": {"format": "doc_values"}}
and {"doc_values": false} wins, so the test is not using doc values while it
thought it would.
2015-04-08 09:45:50 +02:00
Boaz Leskes 80e86e5719 Transport: shortcut local execution
In several places in the code we need to notify a node it needs to do something (typically the master). When that node is the local node, we have an optimization in serveral places that runs the execution code immediately instead of sending the request through the wire to itself. This is a shame as we need to implement the same pattern again and again. On top of that we may forget (see note bellow) to do so and we might have to write some craft if the code need to run under another thread pool.

This commit folds the optimization in the TrasnportService, shortcutting wire serliazition if the target node is local.

Note: this was discovered by #10247 which tries to import a dangling index quickly after the cluster forms. When sending an import dangling request to master, the code didn't take into account that fact that the local node may master. If this happens quickly enough, one would get a NodeNotConnected exception causing the dangling indices not to be imported. This will succeed after 10s where InternalClusterService.ReconnectToNodes runs and actively connects the local node to itself (which is not needed), potentially after another cluster state update.

Closes #10350
2015-04-08 09:10:47 +02:00
Adrien Grand 89b97c1c8d Upgrade to lucene-5.1.0-snapshot-1671894.
This includes a fix for LUCENE-6406.
2015-04-07 20:04:54 +02:00
jaymode 1edf883bae Netty: make exceptionCaught method protected
The exceptionCaught method had default access, which imposes a requirement
for subclasses that need to override this method to be in a specific package. This
change simply makes the method protected, which removes the package requirement.
2015-04-07 13:09:47 -04:00
Adrien Grand 967a4e2a86 Internal: Make APIs work per-segment like Lucene's Collector.
We still have a lot of APIs that use setNextReader in order to change the
current segment that should be considered. This commit moves such APIs to
getLeafXXX() instead to be more in-line with Lucene 5's collector API.

I also renamed setDocId to setDocument to be more in-line with the doc values
APIs.

Close #10389
2015-04-07 17:56:01 +02:00
Adrien Grand 884c40abac Merge pull request #9165 from jpountz/enhancement/reduce_search_pool_size
Internal: reduce the size of the search thread pool.
2015-04-07 17:49:50 +02:00
Adrien Grand eb52febf0c Merge pull request #10393 from jpountz/fix/112_snapshot
Internal: Fix snapshot status of version 1.1.2.
2015-04-07 17:28:40 +02:00
Shay Banon af19ec3006 Remove content thread safe from REST layer
there is no need for this anymore, for some time, since in netty now we rely on copying over the buffer and reusing it
closes #10429
2015-04-07 18:11:48 +03:00
Adrien Grand ca6f6d4283 Tests: work-around for LUCENE-6406. 2015-04-07 16:57:20 +02:00
Simon Willnauer c2f9987a15 [TEST] expect simpletext CFS format in test 2015-04-07 15:36:45 +02:00
Simon Willnauer f1abf0aa10 Update Lucene version constants for 1.4.5 and above to 4.10.4 2015-04-07 15:26:58 +02:00
Adrien Grand 37f3351b58 Tests: Speed up CopyOnWriteHash(Map|Set)Tests
These tests create artificial hash collisions in order to make sure that they
can be resolved correctly. But this also makes the tests very slow if there
are too many collisions because insertions/deletions become linear in such
cases. The tests have been modified to not do too many iterations when
collisions are likely.

Close #10442
2015-04-07 13:34:08 +02:00
Robert Muir 1d56502e52 Upgrade to Lucene 5.1 r1671277.
Closes #10435.

Squashed commit of the following:

commit aa1935c790b2731fc2bbc7de6142b09e3fe8bd4a
Author: Ryan Ernst <ryan@iernst.net>
Date:   Mon Apr 6 13:44:40 2015 -0700

    fix index lookup

commit bb6373595ff62ffc56fdf0cba3ac9c0ebe679946
Merge: 916962b eb3a170
Author: Robert Muir <rmuir@apache.org>
Date:   Mon Apr 6 14:24:38 2015 -0400

    Merge branch 'lucene_r1671277' of github.com:elasticsearch/elasticsearch into lucene_r1671277

commit 916962b82d192a53add471b4cc4a1396bc30eb0e
Merge: 197b3a2 21f72fe
Author: Robert Muir <rmuir@apache.org>
Date:   Mon Apr 6 07:09:41 2015 -0400

    Merge branch 'master' into lucene_r1671277

commit eb3a1703f7932ddd0cf3e83bec0e86131d255407
Author: Ryan Ernst <ryan@iernst.net>
Date:   Sat Apr 4 11:06:03 2015 -0700

    re-enable index lookup tests

commit 80d65d5eab39062dd8364687da74ddbb87ebcb76
Author: Ryan Ernst <ryan@iernst.net>
Date:   Sat Apr 4 10:39:52 2015 -0700

    update pom to point to new snapshot repo

commit 197b3a21ac2c2d70c9f740fe53e58632a22d1aad
Author: Robert Muir <rmuir@apache.org>
Date:   Sat Apr 4 12:51:22 2015 -0400

    fix postingsenum usage

commit 0e2b7a00cd07d068f755c51185ac521aa1eb0326
Author: Robert Muir <rmuir@apache.org>
Date:   Sat Apr 4 12:21:23 2015 -0400

    upgrade to lucene r1671277 (have not yet run tests or looked at postings changes)
2015-04-07 06:09:35 -04:00
Tanguy Leroux a598123838 AbstractBlobContainer.deleteByPrefix() should not list all blobs
The current implementation of AbstractBlobContainer.deleteByPrefix() calls AbstractBlobContainer.deleteBlobsByFilter() which calls BlobContainer.listBlobs() for deleting files, resulting in loading all files in order to delete few of them. This can be improved by calling BlobContainer.listBlobsByPrefix() directly.

This problem happened in #10344 when the repository verification process tries to delete a blob prefixed by "tests-" to ensure that the repository is accessible for the node. When doing so we have the following calling graph: BlobStoreRepository.endVerification() -> BlobContainer.deleteByPrefix() -> AbstractBlobContainer.deleteByPrefix() -> AbstractBlobContainer.deleteBlobsByFilter() -> BlobContainer.listBlobs()... and boom.

Also, AbstractBlobContainer.listBlobsByPrefix() and BlobContainer.deleteBlobsByFilter() can be removed because it has the same drawbacks as AbstractBlobContainer.deleteByPrefix() and also lists all blobs. Listing blobs by prefix can be done at the FsBlobContainer level.

Related to #10344
2015-04-07 11:04:41 +02:00
Boaz Leskes 9e18746ea0 Test: increase timeout in UnicastZenPingTests#testSimplePings 2015-04-07 10:07:58 +02:00
Boaz Leskes 59d6bd8881 Test: mute testOldIndexes
Ensure greens times out often. See https://github.com/elastic/elasticsearch/issues/10434
2015-04-07 09:19:01 +02:00
Ryan Ernst 9c209e46be Test: make httpClient() helper not rely on internalCluster (which may be read only) 2015-04-06 23:25:53 -07:00
Masaru Hasegawa 21f72fed0a Queries: Avoid NPE during query parsing
Workaround until Jackson is upgraded to 2.6.x.
Fixes #8629.
2015-04-06 12:26:14 +09:00
Ryan Ernst 9191da9d9f Test: temporarily avoiding replica problems with 0.90.13, see #10434 2015-04-04 09:27:12 -07:00
Ryan Ernst c3011cead4 Tests: Revamp static bwc test framework to use dangling indexes
The static old index tests currently take a long time to run because
each index version essentially recreates the cluster, and spins up
new nodes.  This PR instead loads each old version into the existing
cluster as a dangling index. It also removes the intermediate
"StaticIndexBackwardCompatibilityTest" which was an extra layer
with no purpose, and moves a shared version of a commonly found
function to get an http client.

The test now takes between 40 and 60 seconds for me. I also ran it
"under stress" by running all ES tests in one shell, while
simultaneously running 10 iterations of the old index tests. Each
iteration took on average about 90 seconds, which is much better
than the 20+ minutes we see in master on jenkins.

closes #10247
2015-04-03 23:21:55 -07:00
Ryan Ernst d379b3618e Mappings: Fix doc values representation to always serliaze if explicitly set
When doc values are explicitly set to the default value serialization
is skipped. This means the alternate way of specifying doc values,
through `fielddata.format: doc_values`, will take precedense if
present.

This change fixes doc values to always be serialized when an explicit value
was passed, so that it continues to take precedence over
`fielddata.format`.

closes #10297
closes #10302
2015-04-03 19:35:52 -07:00
Ryan Ernst 96fa466414 Tests: Skip Version.CURRENT for static bwc indexes
The current version is normally a snapshot while in development.
However, when the release process changes the snapshot flag to false,
this causes the static bwc tests to fail because they cannot
find an index for the current version.  Instead, this change
skips the current version, because there is no need to test
a verion's bwc against itself.

closes #10292
closes #10293
2015-04-03 19:25:43 -07:00
Adrien Grand c7115f8364 Mappings: Bring back numeric_resolution.
We had an undocumented parameter called `numeric_resolution` which allows to
configure how to deal with dates when provided as a number. The default is to
handle them as milliseconds, but you can also opt-on for eg. seconds.

Close #10072
2015-04-03 19:54:14 +02:00
Martijn van Groningen 3f8908acfb Test: Not all shards maybe in a started state after the initial scroll search, but are after we do the stats call, so add ensureGreen to ensure we don't up with this discrepancy 2015-04-03 18:30:59 +02:00
Adrien Grand 24ca482918 Tests: Make OldIndexBackwardsCompatibilityTests copy to fewer replicas.
We recently increased the size of bw indexes and backward compatibility tests
are now taking more time so it makes sense to ask them to do a bit less. This
commit changes the number of replicas we try to copy primaries to from (2 or 3)
to (1 or 2).
2015-04-03 16:46:30 +02:00
Adrien Grand d3b1567f79 Tests: Add more assertions to SearchStatsTests. 2015-04-03 16:09:57 +02:00
Adrien Grand 523033bce6 Test: Disable TRACE logging on aggregations tests. 2015-04-03 11:33:30 +02:00
Martijn van Groningen ef1f834cf9 inner hits: Make sure inner hits also work for nested fields defined in object field
Closes #10334
2015-04-03 08:57:10 +02:00
Igor Motov 5379fa04de Snapshot/Restore: separate repository registration
Separate repository registration to make sure that failure in registering one repository doesn't cause failures to register other repositories.

Closes #10351
2015-04-02 22:23:43 -04:00
Lee Hinman 8f13c5ad4d [TEST] Turn on more logging for testDataPathCanBeChanged 2015-04-02 20:11:33 -06:00
Eike Dehling 2fc2c8284a Mapping: add consistent serialization order for field data settings
Closes #10370
Closes #10318
2015-04-02 21:41:52 +02:00
Adrien Grand 1401075070 Tests: Speed up backward-compatibility tests for 1.1.0
1.1.0 is affected by #5817 which prevents merges from keeping up with the
indexing rate. As a consequence it generates lots of segments and makes bw
compat tests slow. So I added a special case for this version to index fewer
documents.
2015-04-02 19:11:12 +02:00
Tanguy Leroux 168238dab6 Add properties files to configure startup and installation scripts
Many scripts are used to start/stop and install/uninstall elasticsearch. These scripts share a lot of configuration properties like directory paths, max value for a setting, default user etc. Most of the values are identical but some of them are different depending of the platform (Debian-based or Redhat-based OS), depending of the way elasticsearch is started (shell script, systemd, sysv-init...) or the way it is installed (zip, rpm, deb...). Today the values are duplicated in multiple places, making it difficult to maintain the scripts or to update a value.

This pull request make this more uniform: values used in scripts must be defined in a common packaging.properties file. Each value can be overridden in another specific packaging.properties file for Debian or Redhat. All startup and installation scripts are filtered with the common then the custom packaging.properties files before being packaged as a zip/tar.gz/rpm/dpkf archive.
2015-04-02 18:09:43 +02:00
Adrien Grand 08388e0389 Internal: reduce the size of the search thread pool.
Follow-up of #9135. We initially decreased the stack size because it would end
up a lot of memory when there are many threads. But we also have some thread
pools that may be oversized, in particular the search thread pool.

This commit proposes to decrease the default search thread pool size from
`3 * num_procs` to `3 * num_procs / 2 + 1`. This is large enough to be sure
that we can use all the machine resources even with a search-only work load
but not too large in order to not consume too much memory because of the stack
size and thread locals.
2015-04-02 16:32:20 +02:00
Adrien Grand 08f93cf33f Add doc values support to boolean fields.
This pull request makes boolean handled like dates and ipv4 addresses: things
are stored as as numerics under the hood and aggregations add some special
formatting logic in order to return true/false in addition to 1/0.

For example, here is an output of a terms aggregation on a boolean field:
```
   "aggregations": {
      "top_f": {
         "doc_count_error_upper_bound": 0,
         "buckets": [
            {
               "key": 0,
               "key_as_string": "false",
               "doc_count": 2
            },
            {
               "key": 1,
               "key_as_string": "true",
               "doc_count": 1
            }
         ]
      }
   }
```

Sorted numeric doc values are used under the hood.

Close #4678
Close #7851
2015-04-02 15:40:46 +02:00
Adrien Grand 3d09292a9f Internal: Fix snapshot status of version 1.1.2.
org.elasticsearch.Version mistakenly tags 1.1.2 as a snapshot version while it
has been released.
2015-04-02 15:34:38 +02:00
Martijn van Groningen e390ef5bc1 inner hits: Make sure `size` of `0` works on the `inner_hits` level.
Closes #10358
2015-04-02 15:08:39 +02:00
Britta Weber 3772bd6738 [TEST] more restrictive logging 2015-04-02 13:36:07 +02:00
Britta Weber 82071659de recovery state: fix concurrent access to file list
A shard recovery response might serialize a shard state at the same time that it is
modified by the recovery process. The test
RelocationTests.testMoveShardsWhileRelocation
failed because of this with a ConcurrentModificationException.

closes #10381
2015-04-02 12:37:12 +02:00
Christoph Büscher 2beda3953d Remove expansion of empty index arguments in RoutingTable
RoutingTables activePrimaryShardsGrouped(), allActiveShardsGrouped() and
allAssignedShardsGrouped() methods treated empty index array input
parameters as meaning "all" indices and expanded to the routing maps
keyset. However, the expansion of index names is now already done in
MetaData#concreteIndices(). Returning an empty index name list here
when a wildcard pattern didn't match any index name could lead to
problems like #9081 because the RoutingTable still expanded this
list of names to "_all". In case of e.g. the recovery endpoint this
could lead to problems.

Closes #9081
Closes #10148
2015-04-02 12:29:47 +02:00
Simon Willnauer d30d3b967e Merge pull request #10376 from dakrone/misc-addl-logging
Miscellaneous additional logging and cleanups
2015-04-02 12:19:52 +02:00
Adrien Grand 4d4dcef857 Merge pull request #10373 from djschny/issue10371
Add ability to specify a SizeBasedTriggeringPolicy for log configuration.

Close #10371
2015-04-02 11:17:00 +02:00
Britta Weber 4259ab78f3 [TEST] set mmn to avoid split brain 2015-04-02 10:51:14 +02:00
Britta Weber 4d95f6dc39 [TEST] increase logging for SharedClusterSnapshotRestoreTests.basicWorkFlowTest 2015-04-02 10:51:14 +02:00
Lee Hinman 9ff217d89b Clean up logging and add additional logging regarding shadow engines
This fixes an issue where this was logged:

```
[node_t1] [test][0] flush with org.elasticsearch.action.admin.indices.flush.FlushRequest@65f6f1e
```

by adding a .toString() method to FlushRequest.

It also changes:

```
creating Index [test], shards [1]/[2]
```

to:

```
creating Index [test], shards [1]/[2s]
```

If shadow replicas are being used.
2015-04-01 11:49:26 -06:00
Simon Willnauer 1047e8bce5 [TEST] don't restrict index to nodes 2015-04-01 18:33:02 +02:00
Simon Willnauer efb82910a1 Merge pull request #9242 from reuben-sutton/remove_jsonp
Remove jsonp support and associated tests, closes #9108
2015-04-01 18:18:52 +02:00
Ryan Schneider 3126c9b39d add ability to specify a SizeBasedTriggeringPolicy for log configuration #10371 2015-04-01 11:32:01 -04:00
Reuben Sutton 85c221e9b1 Remove jsonp support and associated tests, closes #9108 2015-04-01 16:06:09 +01:00
Simon Willnauer dc38df2b20 [RESTORE] Don't reuse source index UUID on restore
Today we reuse the UUID of the source index on restore. This can create conflicts
with existing shard state on disk. This also causes multiple indices with the same
UUID. This commit preserves the UUID of an existing index or creates a new UUID for
a newly created index.
2015-04-01 15:56:26 +02:00
Shay Banon c8f996320c Remove unsafe options
For quite some time now, our networking layer makes sure to create safe messages as in not using the shared buffers. This is great, and we should remove the old support for "unsafe" notion in our codebase.
closes #10360
2015-04-01 15:11:20 +03:00
Christoph Büscher 285941f0d3 Removed unused import 2015-04-01 12:02:21 +02:00
Christoph Büscher fc04967eda Core: Remove potential NPE while resolving concrete indices from MetaData
Prevents a current edge case resolving concrete aliases or index names in cluster MetaData
that could potentialy lead to NullPointerException when the IndicesOptions don't allow
wildcard expansion and the method is called with aliasesOrIndices argument null or emtpy list.
This change adds a check for that and introduces randomized test that catches this.

Closes #10342
Closes #10339
2015-04-01 10:59:09 +02:00
Martijn van Groningen 1c162ed34a inner hits: Fix bug where parse error is thrown if a inner filter is used in a nested filter/query.
Closes #10308
2015-03-31 22:44:39 +02:00
David Wittman 3acf4ccb33 Fix typos for gateway.recover_after_time
There were a few references to the setting
`gateway.recovery_after_time`, which should instead be
`gateway.recover_after_time`.
2015-03-31 14:00:08 -05:00
Adrien Grand 9c1c335d02 Search contexts should not automatically be closed when scrolling.
Related to #9296
2015-03-31 20:10:09 +02:00
Britta Weber 567a50c29b [function_score] apply min_score to sub query score if no function provided
For optimization pruposes a function score query with an empty function
will just result in the original sub query. However, sometimes one might
want to use function_score query to actually filter out docs within for example
bool clauses by using the min_score functionallity.
Therefore the sub query should only be used without wrapping inside
a function_score query if min_score was also not set.

closes #10253
closes #10326
2015-03-31 16:16:53 +02:00
Britta Weber 17dffe222b [store] make sure shard active request works even if shard is still in post recovery
When deleting a shard th node that deletes th shard first checks if all shard copies are
started on other nodes. A message is sent to each node tand each node checks locally for
STARTED or RELOCATED.
However, it might happen that the shard is still in state POST_RECOVERY, like this:

shard is relocating from node1 to node2
1. relocated shard on node2 goes in POST_RECOVERY and node2 sends shard started to master
2. master updates routing table and sends new cluster state to node1 and node2
3. node1 processes the cluster state and asks node2 if it has the active shard
  before node2 processes the new cluster state (which would cause it to set the shard to started)
4. node2 sends back it does not have the shard started and so node1 does not delete it

This can be avoided by waiting until cluster state that sets the shard to started is actually processed.

closes #10018
2015-03-31 15:42:07 +02:00
Adrien Grand 8d204846df Remove leftover println. 2015-03-31 15:00:18 +02:00
Simon Willnauer 78d86bcf41 [STATE] Refactor state format to use incremental state IDs
Today there is a chance that the state version for shard, index or cluster
state goes backwards or is reset on a full restart etc. depending on
several factors not related to the state. To prevent any collisions
with already existing state files and to maintain write-once properties
this change introductes an incremental state ID instead of using the plain
state version. This also fixes a bug when the previous legacy state had a
greater version than the current state which causes an exception on node
startup or if left-over files are present.

Closes #10316
2015-03-31 14:17:07 +02:00
javanna ff6b605778 [TEST] fix SearchScrollTests, scroll doesn't support searchType count 2015-03-31 14:05:33 +02:00
javanna 83fb0a10e5 Scripting: remove support for script.disable_dynamic setting
Now that fine-grained script settings are supported (#10116) we can remove support for the script.disable_dynamic setting.

Same result as `script.disable_dynamic: false` can be obtained as follows:

```
script.inline: on
script.indexed: on
```
An exception is thrown at startup when the old setting is set, so we make sure we tell users they have to change it rather than ignoring the setting.

Closes #10286
2015-03-31 13:24:52 +02:00
Adrien Grand 7a595d7911 IndicesQueryCacheTests: Fix test bug.
The query cache is disabled on dfs_query_then_fetch so we need to enforce
query_then_fetch instead of relying on the randomized search type set by the
test framework.
2015-03-31 12:28:02 +02:00
Adrien Grand 0a6be2c111 Merge pull request #9296 from jpountz/enhancement/remove_count_search_type
Search: Merge `search_type=count` and `size=0`.

Close #9226
2015-03-31 11:36:38 +02:00
Adrien Grand a608db122d Search: Remove the `count` search type.
This commit brings the benefits of the `count` search type to search requests
that have a `size` of 0:
 - a single round-trip to shards (no fetch phase)
 - ability to use the query cache

Since `count` now provides no benefits over `query_then_fetch`, it has been
deprecated.

Close #7630
2015-03-31 11:31:49 +02:00
Adrien Grand 171e415a47 Tests: Assert that we do not leak SearchContexts.
Even if there is a background thread that periodically closes search contexts
that seem unused (every minute by default), it is important to close search
contexts as soon as possible in order to not keep unnecessary open files or
to prevent segments from being deleted.

This check would help ensure that refactorings of the SearchContext management
like #9296 are correct.
2015-03-31 11:31:49 +02:00
Igor Motov 96f4c06f46 Automatically add "index." prefix to the settings are changed on restore if the prefix is missing
Closes #10133
2015-03-30 17:39:11 -04:00
Michael McCandless b00b2b9baa fix test concurrency bug 2015-03-30 17:39:41 -04:00
jaymode a2addaf320 Netty: add getter for channel in NettyTransportChannel
Adds a getter for the actual netty channel in NettyTransportChannel. The
channel can be used by plugins that need access into netty when processing
requests.
2015-03-30 12:41:57 -04:00
jaymode 77418ecdbd [TEST] move FakeRestRequest to org.elasticsearch.test.rest
FakeRestRequest is used by a few tests and can also be leveraged by
tests outside of elasticsearch. Moving the package will mean the class
gets exported as part of the test jar.
2015-03-30 12:01:44 -04:00
Michael McCandless 87aa39a0d2 Core: deletions (alone) should also force a refresh when version map is using too much RAM
We already force a refresh in index/create ops, to clear version map
when it's using too much RAM, but we were failing to do this for
deletes, so an app that does tons of deletes with no indexing, and has
set refresh_interval to -1, would have version map using unbounded
RAM.

Closes #10312
2015-03-30 10:25:55 -04:00
Boaz Leskes 1200d8e647 Recovery: RecoveryState.File.toXContent reports file length as recovered bytes
Closes #10310
2015-03-30 16:12:37 +02:00
Boaz Leskes fd3b01d810 Internal: don't try to send a mapping refresh if there is no master
After processing mapping updates from the master, we compare the resulting binary representation of them and compare it the one cluster state has. If different, we send a refresh mapping request to master, asking it to reparse the mapping and serialize them again. This mechanism is used to update the mapping after a format change caused by a version upgrade.

The very same process can also be triggered when an old master leaves the cluster, triggering a local cluster state update. If that update contains old mapping format, the local node will again signal the need to refresh, but this time there is no master to accept the request. Instead of failing (which we now do because of #10283, we should just skip the notification and wait for the next elected master to publish a new mapping (triggering another refresh if needed).

Closes #10311
2015-03-30 15:24:00 +02:00
Adrien Grand a1505e7164 Tests: Assert that we do not leak SearchContexts.
Even if there is a background thread that periodically closes search contexts
that seem unused (every minute by default), it is important to close search
contexts as soon as possible in order to not keep unnecessary open files or
to prevent segments from being deleted.

This check would help ensure that refactorings of the SearchContext management
like #9296 are correct.
2015-03-30 10:39:08 +02:00
olivier bourgain 7a5e3c1b1d fix wrong use of currentFieldName outside of a parsing loop 2015-03-29 18:35:21 +02:00
javanna 38ec5084a5 [TEST] resolved compiler warnings in ShapeBuilderTests and GeoPointParsingTests 2015-03-29 11:49:36 +02:00
Sebastian Monte 9a29705c49 Fix errors reported by error-prone
I compiled elasticsearch with error-prone
(https://github.com/google/error-prone). This commit fixes the 13
errors reported by the tool.
2015-03-29 11:43:56 +02:00
Martijn van Groningen 6d1a1b328b Make sure that the parent option on the update request only is delgated to upsert index request.
Closes #4538
2015-03-28 08:53:11 +01:00
Martijn van Groningen 75713f4190 Reverted commit: 20f7be3 2015-03-28 08:53:11 +01:00
Martijn van Groningen d78159fee1 Added lost comment 2015-03-28 08:52:39 +01:00
Martijn van Groningen 16d8f3ce81 aggs: Fix 2 bug in `children` agg
1) multiple nested children aggs result in a NPE
2) fixed a counting bug where the same readers where post collected twice

Closes #10158
2015-03-28 08:43:40 +01:00
Martijn van Groningen 3df3259a74 inner_hits: Fix nested stored field support.
This also fixes a NPE when the nested part has been filtered out of the _source, because of _source filtering.

Closes #9766
2015-03-28 08:02:30 +01:00
Britta Weber ccf5482956 [TEST] muste test and add issue number 2015-03-27 17:35:38 +01:00
Shay Banon 6181d8ecde Fail shard when index service/mappings fails to instantiate
When the index service (which holds shards) fails to be created as a result of a shard being allocated on a node, we should fail the relevant shard, otherwise, it will remain stuck.
Same goes when there is a failure to process updated mappings form the master.

Note, both failures typically happen when the node is misconfigured (i.e. missing plugins, ...), since they get created and processed on the master node before being published.
closes #10283
2015-03-27 16:58:24 +01:00
javanna 71bd40517d [TEST] remove GlobalScopeClusterTests
We removed the global ClusterScope a while ago, its related test can be removed too.
2015-03-27 15:04:42 +01:00
Tanguy Leroux c19b7a2f61 Fix thread leak in Hunspell service
An unchecked exception might be thrown when instantiating the HunspellService, leading to thread leaks in tests.

Closes #9849
2015-03-27 09:50:11 +01:00
Ryan Ernst 5b0512fcc3 Fix BigLongArray.fill to account for an empty range 2015-03-27 00:43:40 -07:00
Ryan Ernst e0334dcb9e Core: Enable doc values by default, when appropriate
Doc values significantly reduced heap usage, which results in faster
GCs. This change makes the default for doc values dynamic: any
field that is indexed but not analyzed now has doc values. This only
affects fields on indexes created with 2.0+.

closes #8312
closes #10209
2015-03-26 22:42:35 -07:00
Britta Weber 3f459f69a7 [TEST] wait for mapping, cluster state might not be up to date yet 2015-03-27 00:51:19 +01:00
Britta Weber edb6319cea [mappings] update dynamic fields in mapping on master even if parsing fails for the rest of doc
The local DocumentMapper is updated while parsing and dynamic fields are added before
parsing has finished. If parsing fails after a dynamic field has been added already
then the field was not added to the cluster state but was present in the local mapper of this
node. New documents with the same field would not necessarily cause an update either and
after restarting the node the mapping for these fields were lost. Instead the new fields
should always be updated.

closes #9851
closes #9874
2015-03-26 21:06:00 +01:00
javanna 18b02d58a4 [TEST] enable inline scripts on demand in bw comp tests
We currently have a single bw comp test (FunctionScoreBackwardCompatibilityTests) that requires inline scripts on.
After introducing fine-grained script settings, we moved the internal cluster to use the newer settings, but they are not supported by older nodes started as part of the bw comp tests. Moved script settings out of the default settings, so they won't be part of the ordinary settings when running bw comp tests.
Added logic in FunctionScoreBackwardCompatibilityTests to enable dynamic scripts using the proper setting, depending on the version of the node.
2015-03-26 19:56:55 +01:00
javanna d9d1e6a67a Scripting: add support for fine-grained settings
Allow to on/off scripting based on their source (where they get loaded from), the  operation that executes them and their language.

The settings cover the following combinations:

- mode: on, off, sandbox
- source: indexed, dynamic, file
- engine: groovy, expressions, mustache, etc
- operation: update, search, aggs, mapping

The following settings are supported for every engine:

script.engine.groovy.indexed.update:    sandbox/on/off
script.engine.groovy.indexed.search:    sandbox/on/off
script.engine.groovy.indexed.aggs:      sandbox/on/off
script.engine.groovy.indexed.mapping:   sandbox/on/off
script.engine.groovy.dynamic.update:    sandbox/on/off
script.engine.groovy.dynamic.search:    sandbox/on/off
script.engine.groovy.dynamic.aggs:      sandbox/on/off
script.engine.groovy.dynamic.mapping:   sandbox/on/off
script.engine.groovy.file.update:       sandbox/on/off
script.engine.groovy.file.search:       sandbox/on/off
script.engine.groovy.file.aggs:         sandbox/on/off
script.engine.groovy.file.mapping:      sandbox/on/off

For ease of use, the following more generic settings are supported too:

script.indexed: sandbox/on/off
script.dynamic: sandbox/on/off
script.file:    sandbox/on/off

script.update:  sandbox/on/off
script.search:  sandbox/on/off
script.aggs:    sandbox/on/off
script.mapping: sandbox/on/off

These will be used to calculate the more specific settings, using the stricter setting of each combination. Operation based settings have precedence over conflicting source based ones.

Note that the `mustache` engine is affected by generic settings applied to any language, while native scripts aren't as they are static by definition.

Also, the previous `script.disable_dynamic` setting can now be deprecated.

Closes #6418
Closes #10116
Closes #10274
2015-03-26 19:56:55 +01:00
Michael McCandless 442f539802 Tests: improve back compat tests by adding delete-by-query in the transaction log on upgrade
Closes #10266
2015-03-26 10:12:22 -04:00
Ryan Ernst ae41d1e03d Mappings: Fix _field_names to be disabled on pre 1.3.0 indexes
In #9893, an enabled flag was added for _field_names.  However,
backcompat for indexes created before 1.3.0 (when _field_names
was added) was lost. This change corrects the mapper
to always be disabled when used with older indexes that
cannot have _field_names.

closes #10268
2015-03-25 14:27:24 -07:00
Leonardo Menezes 5feaa484b5 Cat api: added node id column to _cat/plugins response
relates to #10226
2015-03-25 12:00:38 +01:00
Leonardo Menezes d086648cec Cat api: added node id column to _cat/segments response
Relates to #10226
2015-03-25 12:00:15 +01:00
Leonardo Menezes bad60cea13 Cat api: added node id column to _cat/shards response
closes #10226
2015-03-25 11:59:35 +01:00
Ryan Ernst 693d91e41c Mappings: Remove delete mapping API
Deleting a type from an index is inherently dangerous because
the type can be recreated with new mappings which may conflict
with existing segments still using the old mappings. This
removes the ability to delete a type (similar to how deleting
fields within a type is not allowed, for the same reason).

closes #8877
closes #10231
2015-03-24 09:46:02 -07:00
Colin Goodheart-Smithe 53de93a89b Aggregations: Added Factory for all MultiBucketAggregations to implement
This allows things like reducers to add aggregations to buckets without needing to know how to construct the aggregation or bucket itself.
2015-03-24 15:17:45 +00:00
Britta Weber 3add12a970 function_score: undo "Remove explanation of query score from functions"
This adds the Explanation to the explain score again. It is needed
because the explanation of script functions will otherwise not contain
an explanation of _score if boost mode is set to replace.

closes #9826
2015-03-24 15:48:48 +01:00
Nicholas Knize e43f3a941b [GEO] Fix validate_* merge policy for GeoPointFieldMapper
Fail merge if validate_lat or validate_lon values are not equal. This will prevent inconsistencies between geo_points in a merged index, and parse exceptions for bounding_box and distance filters.

Also merged separate GeoPoint test classes into a single GeoPointFieldMapperTest to be consistent with GeoShapeFieldMapperTests.

closes #10164
2015-03-24 08:15:15 -05:00
Boaz Leskes c6ce64a5e5 Remove backward compatibility layer introduced in #6149
Closes #6229
2015-03-24 13:04:59 +01:00
Colin Goodheart-Smithe 2bf42dc9a0 [TEST] explicitly map fields in SignificantTermsBWCTests 2015-03-24 11:21:06 +00:00
Robert Muir 10e6fa1963 fix build with java 9
* add compiler workarounds for JDK bug JI-9019884
* remove permgen specification during tests (this results in an error on java 9)
* fix threadpool grow/shrink to call methods in the right order (this results in IAE with java 9)
2015-03-24 00:29:24 -04:00
Boaz Leskes f5923403a1 Test: RecoveryFromGatewayTests.testReusePeerRecovery - increase concurrent recoveries
To speed up the test and prevent ensureGreen() from timing out.
2015-03-23 22:02:46 +01:00
javanna 6dc06063c7 Revert "Internal: change logging from debug to warning in PublishClusterStateAction"
This reverts commit 166fd04239.

Turns out that having log.warn produces a duplicated warn log, as the same message is already logged warn in NettyTranspo
rt#exceptionCaught.
2015-03-23 18:33:24 +01:00
Devin Chollak 166fd04239 Internal: change logging from debug to warning in PublishClusterStateAction
Closes #9594
2015-03-23 17:49:19 +01:00
Martijn van Groningen 6bebb94ea8 Added 1.5.1 version and set 1.5.0 snapshot to false 2015-03-23 16:29:35 +01:00
Ryan Ernst 66669c337b Tests: Add static bwc index for 1.5.0 2015-03-23 08:04:05 -07:00
Boaz Leskes cde7d9af1c Transport: fix racing condition in timeout handling
If a request comes in at the same moment the timeout handler for it runs, we may leak a timeoutInfoHolder and erroneously log "Transport response handler not found of id" . The same issue could cause the request tracer to fire a traceUnresolvedResponse call instead of traceReceivedResponse , causing a failure of testTracerLog ( see #10187 ) .

This commit makes sure timeoutInfoHolder is visible before removing the corresponding RequestHolder. It also unifies the TransportService.Adapter#remove(requestId) with TransportService.Adapter#onResponseReceived(requestId), as they are always called together to indicate a response was received.

Closes #10187
Closes #10220
2015-03-23 14:40:08 +01:00
Boaz Leskes f5f9739117 Recovery: only cancel when primary completed relocation
When a primary moves to another node, we cancel ongoing recoveries and retry from the primary's new home. At the moment this happens when the primary relocation *starts*. It's a shame as we cancel recoveries that may be close to completion and will finish before the primary has been fully relocated. This commit only triggers the cancelation once the primary relocation is completed.

Next to this, it fixes a race condition between recovery cancellation and the recovery completion. At the moment we may trigger remove a recovered shard just after it was completed. Instead, we should use the recovery cancellation logic to make sure only one code path is followed.

All of the above caused the recoverWhileUnderLoadWithNodeShutdown test to fail (see http://build-us-00.elastic.co/job/es_core_15_debian/32/ ). The test creates an index and then increasingly disallows nodes for it, until only 1 node is left in the allocation filtering rules. Normally, this means we stay in green, but the premature recovery cancellation plus the race condition mentioned above caused a shard to be failed and stay unassigned and the test asserts to fail. This happens due to the following sequence:

- The shard has finished recovering and sent the master a shard started command.
- The recovery is cancelled locally, removing the index shard.
- Master starts shard (deleting it's other copy).
- Local node gets a cluster state with the shard started in it, which cause it to send a shard failed (to make the master aware).
- Shard is failed and can't be re-assigned due to the allocation filter.

The recoverWhileUnderLoadWithNodeShutdown is also adapted a bit to fit the current behavior of allocation filtering (in the past it used to really shut down nodes). Last, all tests in that class are given better names to fit the current terminology.

Clsoes #10218
2015-03-23 14:24:37 +01:00
Simon Willnauer cae2707375 [ALLOCATION] Verify shards index UUID when fetching started shards
Today we simply fetch the shards metadata without verifying the
index UUID the shard belongs to. We recently added this UUID
to the shard state metadata. This commit adds verification
to the shard metadata fetching to prevent bringing shards
back into an index it doesn't belong to due to name collisions.
2015-03-23 14:04:15 +01:00
Boaz Leskes 4970e3e225 Revert "Rest: Add json in request body to scroll, clear scroll, and analyze API"
This reverts commit 16083d454c.
2015-03-23 12:57:19 +01:00
Britta Weber f34c6b7065 Remove unused code 2015-03-23 11:31:21 +01:00
Sylwester Lachiewicz 341a52d829 ThreadPool: use `equals` instead of `==` for threadpool names comparisons
Although the current comparisons work, since we rely on the fact that we always use the same constants, `equals` seems safer.

Closes #10204
2015-03-23 10:39:08 +01:00