Commit Graph

5030 Commits

Author SHA1 Message Date
Martijn van Groningen 2220c66535 [Discovery] Eagerly clean the routing table of shards that exist on nodes that are not in the latestDiscoNodes list.
Only the previous master node has been removed, so only shards allocated to that node will get failed.
This would have happened anyhow on later on when AllocationService#reroute is invoked (for example when a cluster setting changes or another cluster event),
but by cleaning the routing table pro-actively, the stale routing table is fixed sooner and therefor the shards
that are not accessible anyhow (because the node these shards were on has left the cluster) will get re-assigned sooner.
2014-08-27 15:46:23 +02:00
Martijn van Groningen 89a50f6013 [Discovery] If available newly elected master node should take over previous known nodes. 2014-08-27 15:46:23 +02:00
Martijn van Groningen 549076eb4c [Discovery] Changed the default for the 'rejoin_on_master_gone' option from false to true in zen discovery.
Added AwaitFix for the FullRollingRestartTests.
2014-08-27 15:46:14 +02:00
Martijn van Groningen 3cdbb1a79d [Discovery] Enable `discovery.zen.rejoin_on_master_gone` setting in DiscoveryWithNetworkFailuresTests only. 2014-08-27 15:46:10 +02:00
Martijn van Groningen 97bdc8f5a2 [Discovery] Make noMasterBlock configurable and added simple test that shows reads do execute (partially) when m_m_n isn't met 2014-08-27 15:45:34 +02:00
Shay Banon 6ede83ab45 [Discovery] add rejoin on master gone flag, defaults to false
defaults to false since there is still work left to properly make it work
2014-08-27 15:45:25 +02:00
Shay Banon 4824f05369 [Internal] make no master lock an instance var so it can be configured 2014-08-27 15:45:10 +02:00
Shay Banon 63d0406b67 [Discovery] lightweight minimum master node recovery
don't perform full recovery when minimum master nodes are not met, keep the state around and use it once elected as master
2014-08-27 15:45:02 +02:00
Lee Hinman eaf392163c Add translog checksums
Switches TranslogStreams to check a header in the file to determine the
translog format, delegating to the version-specific stream.

Version 1 of the translog format writes a header using Lucene's
CodecUtil at the beginning of the file and appends a checksum for each
translog operation written.

Also refactors much of the translog operations, such as merging
.hasNext() and .next() in FsChannelSnapshot

Relates to #6554
2014-08-27 15:18:17 +02:00
Adrien Grand b745b0151c Fielddata: Remove soft/resident caches.
These caches have no advantage compared to the default node cache. Additionally,
the soft cache makes use of soft references which make fielddata loading quite
unpredictable in addition to pushing more pressure on the garbage collector.

The `none` cache is still there because of tests. There is no other good
reason to use it.

LongFieldDataBenchmark has been removed because the refactoring exposed a
compilation error in this class, which seems to not having been working for a
long time. In addition it's not as much useful now that we are progressively
moving more fields to doc values.

Close #7443
2014-08-27 14:28:41 +02:00
Britta Weber 238efe505b bool query: parser should return match_all in case there are no clauses
This also fixes has_parent filters with a nested empty bool filter
(see test SimpleChildQuerySearchTests#test6722, the test should actually expect
either 0 results when searching for has_parent "test" or one result when
search for has_parent "foo")

closes #7240
closes #7347
2014-08-27 14:07:21 +02:00
Britta Weber a92300c5b5 explain score: fix explanation streaming
Complex explanations were always read as Explanations. Depending
on if the response was streamed or not the explanation was
therefore generated by a ComplexExplanation or by a regular
Explanation.

closes #7257
2014-08-27 14:07:20 +02:00
javanna 92ae3c84fe Index templates: Made template filtering generic and extensible via plugins
Added the ability to register template filters that are being applied when a new index is created. The default filter that checks whether the template pattern matches the index name always runs first, additional filters can also be registered so that templates can be filtered out based on custom logic.

Took the chance to add the handy source(Object... source) method to PutIndexTemplateRequest and corresponding builder

Closes #7459
Closes #7454
2014-08-27 12:37:36 +02:00
Simon Willnauer e4b7395026 [TEST] only bump replicas if we have enough nodes in the cluster 2014-08-27 12:14:45 +02:00
Colin Goodheart-Smithe 6797d73d7e [TEST] removed AwaitsFix, added checks to make sure indexed scripts are put correctly 2014-08-27 11:04:51 +01:00
Brian Murphy 6109ec36b5 Indexed Scripts : Change preference and thread option for GetRequest.
This change forces the GetRequest when a script is being loaded from an index
to use preference("_local") and threaded(false) to prevent the script service from
forking for GetRequests.
2014-08-27 10:45:53 +01:00
Simon Willnauer 5453c08f50 Use physical name to compare files from snapshot metadata
The comparison and read code in the BlobStoreIndexShardRepository
used the physicalName and Name in reverse order. This caused
SnapshotBackwardsCompatibilityTest to fail.

This reverts commit 636af40da1
2014-08-27 10:47:19 +02:00
Cristiano Fontes ee46c3cd3f Mappings: Added support for empty field arrays
Close #7271
2014-08-27 10:17:05 +02:00
Martijn van Groningen b6cdb1d8fb Parent/child: Add missing support for the field data loading option to the `_parent` field.
Closes #7394
Closes #7402
2014-08-27 09:04:42 +02:00
Martijn van Groningen d414d89c62 Parent/child: If _parent field points to a non existing parent type, then skip the has_parent query/filter
Closes #7362
Closes #7349
2014-08-27 09:00:51 +02:00
Boaz Leskes 8a94044b69 [Test] testLargeClusterStatePublishing - bound max shard no to number of nodes and set replica count to 0
ensureGreen sometimes times out due to too many shards and GC kicking in
2014-08-27 08:34:19 +02:00
Ryan Ernst 1804f864d5 Internal: Add all unsafe variants of LZF compress library functions to forbidden APIs.
The "optimized" encoders/decoders have been unreliable and error prone.
Also, fix LZFCompressor.compress to use LZFEncoder.safeEncode, which
creates a new safe encoder, instead of using a shared encoder (which
is not threadsafe).

closes #7468
2014-08-26 20:17:07 -07:00
Ryan Ernst c94c13fa26 Revert part of change in #7466 to fix issue because encoder is not threadsafe so cannot be shared 2014-08-26 14:04:59 -07:00
Ryan Ernst d79c79c7d0 Internal: Add LZF safe encoder in LZFCompressor
Selecting the safe encoder fixes a 64bit JVM crash on big-endian architectures with
LZF UnsafeChunkEncoderBE.

closes #7466
2014-08-26 13:38:03 -07:00
Adrien Grand 636af40da1 Tests: Temporarily ignore SnapshotBackwardsCompatibilityTest 2014-08-26 18:13:36 +02:00
Adrien Grand 7623c5e401 Tests: Fix FileBasedMappingsTests by using the mappings API instead of field mappings. 2014-08-26 17:54:11 +02:00
Boaz Leskes 35b98f5c24 [Test] rewrite testNoMasterActions to use latest tooling
The test's timeout checks were thrown off by a client created randomly (when the timer was running).

Closes #7432
2014-08-26 17:48:24 +02:00
Britta Weber b754d2b36b Test: mute test until we know what is going on 2014-08-26 15:42:24 +02:00
Simon Willnauer c63626b537 [SNAPSHOT] Add BWC layer to .si / segments_N hashing
Due to additional safety added in #7351 we compute now a strong hash for
.si and segments_N files which are compared during snapshot / restore.
Old snapshots don't have this hash which can cause unnecessary copying
of large amount of data. This commit adds the ability to fetch this
hash from the blob store if needed.

Closes #7434
2014-08-26 15:36:46 +02:00
Simon Willnauer 0676869e6d [ENGINE] Wait until engine is started up when acquireing searcher
Today we have a small window where a searcher can be acquired but the
engine is in the state of starting up. This causes a NPE triggering a
shard failure if we are fast enough. This commit fixes this situation
gracefully.

Closes #7455
2014-08-26 14:07:04 +02:00
Britta Weber d7b8d1728e _all: report conflict on merge and throw exception on doc_values
- _all field was never merged when mapping was updated and no conflict reported
- _all accepted doc_values format although it is always tokenized

relates to #777
closes #7377
2014-08-26 12:14:31 +02:00
mikemccand 075bd66713 Core: use Java's built-in ConcurrentHashMap
It's risky to have our own snapshot of Java 8's ConcurrentHashMap:
unless we keep the sources in sync over time (and OpenJDK's version
had already diverged), then we won't get bug/performance fixes.  Users
can choose to upgrade to Java 8 to see the improvements of CHM.

Closes #7392

Closes #7296
2014-08-26 06:11:05 -04:00
Adrien Grand b43c2ced93 [TESTS] Temporary disable field data cache randomization. 2014-08-25 23:12:09 +02:00
mikemccand 783a9cbb18 Stats: add segments.index_writer_max_memory to see index writer's max RAM usage before buffered documents must be written to a new segment
Closes #7438

Closes #7440
2014-08-25 14:43:09 -04:00
Nik Everett 74287865b2 [Internal] discovery.id.seed is ignored
Closes #7439, Closes #7437
2014-08-25 17:32:07 +02:00
javanna 3917ffc0ff [TEST] Explicitly clean up actions to be intercepted in IndicesRequestTests before asserting on collected requests
This helps making sure that no further requests are collected once we start asserting on them
2014-08-25 17:24:53 +02:00
Lee Hinman 1f7be7931b [TEST] fix issue clearing fielddata breaker introduced in 6950c38a04 2014-08-25 16:25:02 +02:00
Adrien Grand 2a67b129e2 [TESTS] Temporarily disable FileBasedMappingsTests. 2014-08-25 12:39:36 +02:00
markharwood 570c679420 Context suggester: infinite loop in GeolocationContextMapping
Close #7433
2014-08-25 11:56:39 +02:00
Simon Willnauer 6950c38a04 Tests: Improve test coverage.
Close #7428
2014-08-25 11:56:38 +02:00
Alexander Reelsen 49f0f0bb5d Test: Fixed pluggable transport module test to support transportclient
Also made sure, that only a change of requests is tested for and not
an initial value, which might not be set in case of a node client.
2014-08-25 10:36:04 +02:00
Martijn van Groningen bd0b68080b Nested: If the `_type` field isn't indexed nested docs must be filtered out. 2014-08-25 00:09:21 +02:00
Martijn van Groningen d471abe4d3 [TEST] Agg may not be a instance of StringTerms, but UnmappedTerms, so use common Terms class instead 2014-08-25 00:07:19 +02:00
Simon Willnauer 24e3c41afa [TEST] use more verbose assertion in IndicesRequestTests 2014-08-24 21:23:46 +02:00
Boaz Leskes e16a461317 [Tests] testNodeVersionIsUpdated stopped but didn't close it's node 2014-08-24 19:34:02 +02:00
Boaz Leskes 562fe1ddaf [Tests] NoMasterNodeTests make timeout checks less sensitive
Also remove catching of MasterNotDiscoveredException in bulk operation it is only set on a per item basis
2014-08-23 22:04:22 +02:00
javanna 00fc54c2ae Internal: made original indices optional for broadcast delete and delete by query shard requests
Shard requests like broadcast delete and delete by query, that needs to be executed on primary and all replicas, get read and written out to the transport on the same node. That means that if we add some field version checks are not enough to maintain bw comp since a newer node that holds the primary might receive the request from an older node, that didn't provide the field. Yet, when writing the request out again to a newer node that holds the replica, we do try and serialize the field although it's missing. The newer fields just needs to be set to optional in these cases, in addition to the version checks.

Re-enabled testDeleteByQuery and testDeleteRoutingRequired bw comp tests since this was the cause of their failures.

Closes #7406
2014-08-23 17:01:33 +02:00
Simon Willnauer 5f188d29fa [TEST] use CFS consistently to not trigger single segment merge without force flag 2014-08-23 16:41:46 +02:00
Boaz Leskes 06fb9ff761 [Tests] verifyThreadNames should account for new threads of shared cluster
The verifyThreadNames starts a node and checks that all new threads on the JVM are properly named. The current test uses the name of the new node which sometimes fails because our shared cluster spawns a new thread which is properly named but for not for the new name.

The commits relaxes the requirement of the test and on verify the threads are properly named (but not necessarily of the new node)
2014-08-23 14:45:08 +02:00
Simon Willnauer 45f062792c [TEST] use a default host name if localAddress is not available
Closes #7409
2014-08-23 13:47:11 +02:00
Simon Willnauer 805f042293 Add toString() method to Segment.java for debugging purposes 2014-08-23 11:17:14 +02:00
Simon Willnauer fdf1998f39 [ENGINE] Force optimize was not passed to shard request
The force flag to trigger optimiz calls of a single segment for upgrading
etc. was never passed on to the shard request.

Closes #7404
2014-08-22 15:39:04 +02:00
Alex Ksikes e78694ae82 More Like This Query: defaults to all possible fields for items
Items with no specified field now defaults to all the possible fields from the
document source. Previously, we had required 'fields' to be specified either
as a top level parameter or for each item. The default behavior is now similar
to the MLT API.

Closes #7382
2014-08-22 15:07:22 +02:00
Adrien Grand a1a9aadab5 [DOCS] Document the contracts of the RootMapper API.
Close #7400
2014-08-22 14:44:28 +02:00
javanna f4168a6382 Internal: move index templates api back to indices category and make put template and create index implement IndicesRequest
Closes #7378
2014-08-22 10:18:36 +02:00
javanna 9a14b3ce6f [TEST] copied delete bw comp tests to usual intergration tests
Added AwaitsFix to testDeletebyQuery and testDeleteRoutingRequired while checking if they fail as usual integration tests.
2014-08-22 10:12:17 +02:00
Martijn van Groningen 0196377190 [TEST] Muted tests 2014-08-22 09:45:56 +02:00
Simon Willnauer 3b51342515 Use empty BytesRef if we read from <= 1.4.0 2014-08-21 22:13:06 +02:00
Shay Banon ffcc78ca04 Add back string op type to IndexRequest
This was removed by accident I think, and it breaks backward comp. on the Java API in minor 1.3 version
closes #7387
2014-08-21 12:04:09 -07:00
Igor Motov 80887e8113 [TEST] Trigger random flushes while snapshot is created 2014-08-21 12:48:38 -04:00
Simon Willnauer 058a02b7aa [STORE] Improve recovery / snapshot restoring file identity handling
This commit changes the way how files are selected for retransmission
on recovery / restore. Today this happens on a per-file basis where the
rather weak checksum and the file length in bytes is compared to check if
a file is identical. This is prone to fail in the case of a checksum collision
which can happen under certain circumstances.
The changes in this commit move the identity comparsion to a per-commit / per-segment
level where files are only treated as identical iff all the other files in the
commit / segment are the same. This "all or nothing" strategy is reducing the chance for
a collision dramatically since we also use a strong hash to identify commits / segments
based on the content of the ".si" / "segments.N" file.

Closes #7351
2014-08-21 18:00:41 +02:00
Simon Willnauer 4c1bc3ae4f [STORE] Remove unnecessary deduplication 2014-08-21 17:50:04 +02:00
Simon Willnauer 4d3f761d3d [STORE] Ignore segments.gen on metadata snapshots
The segments.gen file is optional and might even change while we
read it. It's safer to just ignore that file in the snapshot instead.
2014-08-21 17:50:04 +02:00
Shay Banon 4af1a29057 [TEST] filter out keep alive timer thread name
Keep-Alive-Timer is an internal Java thread that might be started, make sure to filter it out
2014-08-21 08:40:43 -07:00
Shay Banon 39a64cf4dd [TEST] only reset clients on nightly tests
resetting the clients on each test (in after test) makes the tests running, especially in network mode, much slower, since transport client needs to be created each time when randmized to be used. Also, on OSX, the excessive connections causes bind exceptions eventually which makes running the network tests much harder on it.
closes #7329
2014-08-21 07:34:26 -07:00
Britta Weber ab9e33e38d _ttl: Report conflict when trying to disable _ttl
_ttl could never be disabled once it was enabled.
But when trying to, no conflict was reported.

relates to #777 and #7293

closes #7316
2014-08-21 16:16:08 +02:00
Simon Willnauer 99ef3408fb [STORE] Allow to get metadata from arbitrary commit points
Today we always use the latest commit point to return the metadata from
the store. This might cause problems for snapshot and restore since in
contrast to recovery it won't prevent concurrent flushes (lucene commits).
This can lead to all kinds of interesting effects if we are snapshotting
while flushing. This change uses the IndexCommit to open the metadata snapshot
from the store which is consistent with what we snapshot.

Closes #7376
2014-08-21 16:09:12 +02:00
Colin Goodheart-Smithe 8550b9e84b Aggregations: Fixes pre and post offset serialisation for histogram aggs
Changes the serialisation of pre and post offset to use Long instead of VLong so that negative values are supported.  This actually only showed up in the case where minDocCount=0 as the rounding is only serialised in this case.

Closes #7312
2014-08-21 14:19:53 +01:00
javanna f956920acc Internal: make sure that multi_search request hands over its context and headers to its corresponding search requests
Closes #7374
2014-08-21 15:09:27 +02:00
javanna b6cdaff30c Internal: make sure that multi_percolate request hands over its context and headers to its corresponding shard requests
Closes #7371
2014-08-21 13:45:11 +02:00
Martijn van Groningen 9dd3597f1f [TEST] Sort by the _id field instead of _uid field and also assert the sort value. 2014-08-21 13:30:09 +02:00
javanna c89f941ffa [TEST] added debug lines to bw comp testDeleteByQuery and testDeleteRoutingRequired 2014-08-21 13:11:05 +02:00
Alex Ksikes f1a6b4e9fe More Like This Query: Switch to using the multi-termvectors API
The term vector API can now generate term vectors on the fly, if the terms are
not already stored in the index. This commit exploits this new functionality
for the MLT query. Now the terms are directly retrieved using multi-
termvectors API, instead of generating them from the texts retrieved using the
multi-get API.

Closes #7014
2014-08-21 12:18:21 +02:00
Simon Willnauer c4bed91262 [PARSER] Clarify XContentParser/Builder interface for binary vs. utf8 values
Today we have very confusing naming since some methods names claim to
read binary but in fact read utf-16 and convert to utf-8 under the hood.
This commit clarifies the interfaces and adds additional documentation.

Closes #7367
2014-08-21 11:46:50 +02:00
Adrien Grand b5b1960a2b Internal: Remove CacheRecycler.
The main consumer of this API was the faceting module. Now that it's gone,
let's remove CacheRecycler as well.

Close #7366
2014-08-21 11:21:04 +02:00
javanna 269a6dfb40 [TEST] bw comp testMultiGet should wait for yellow, not for green 2014-08-21 11:14:48 +02:00
javanna 5709a11d23 [TEST] fixed concurrency issue in IndicesRequestTests 2014-08-21 10:43:58 +02:00
Adrien Grand ea96359d82 Facets: Removal from master.
Close #7337
2014-08-21 10:34:39 +02:00
Adrien Grand ded30e95de Aggregations: Remove the logic to optionally sort/dedup values on the fly.
These options are not used anymore. Instead numeric values can now contain dups
and it is the responsibility of the aggregation to deal with it (eg. terms).
And otherwise all values sources are now sorted, which is the contract of the
interfaces that they implement.

Close #7276
2014-08-21 10:25:50 +02:00
Alex Ksikes 62ef4a30dc Term vector API: return 'found: false' for docs between index and refresh
Closes #7121
2014-08-21 09:58:49 +02:00
Igor Motov 150df5f1c5 [TEST] Improve robustness of restoreIndexWithMissingShards test 2014-08-20 21:11:04 -04:00
Shay Banon 9dc4f3861a Query Cache: Add hit and miss count
closes #7355
2014-08-20 14:39:16 -07:00
Shay Banon 2f3a041070 NPE in ShardStats when routing entry is not set yet on IndexShard
closes #7356
2014-08-20 12:48:52 -07:00
javanna abdbfe768b Internal: adjusted internal requests visibility from public to package private (redo)
was just reverted by mistake in the failed attempt of isolating the change and taking it out of #7319
2014-08-20 21:12:37 +02:00
javanna 441c1c8268 Internal: make sure that all shard level requests hold the original indices
A request that relates to indices (`IndicesRequest` or `CompositeIndicesRequest`) might be converted to some other internal request(s) (e.g. shard level request) that get distributed over the cluster. Those requests contain the concrete index they refer to, but it is not known which indices (or aliases or expressions) the original request related to.

This commit makes sure that the original indices are available as part of the shard level requests and makes them implement `IndicesRequest` as well.

Also every internal request should be created passing in the original request, so that the original headers, together with the eventual original indices and options, get copied to it. Corrected some places where this information was lost.

NOTE: As for the bulk api and other multi items api (e.g. multi_get), their shard level requests won't keep around the whole set of original indices, but only the ones that related to the bulk items sent to each shard, the important bit is that we keep the original names though, not only the concrete ones.

Closes #7319
2014-08-20 21:05:01 +02:00
Colin Goodheart-Smithe 0234b5b9b4 fix to compile issue caused by scripted metric aggregation change 2014-08-20 19:25:57 +01:00
Colin Goodheart-Smithe 7f943f0296 Aggregations: Scriptable Metrics Aggregation
A metrics aggregation which runs specified scripts at the init, collect, combine, and reduce phases

Closes #5923
2014-08-20 18:17:27 +01:00
Shay Banon 3a52296358 Warmer (search) to support query cache
allow for search based warmer to support query cache flag on the search request, and use the index level query caching flag if set.
closes #7326
2014-08-20 09:31:29 -07:00
Colin Goodheart-Smithe f7ae4d9d86 Geo: fixes circle radius calculation
This change fixes the creation circle shapes o it calculates it correctly instead of essentially using the diameter as the radius.  The radius has to be converted into degrees but calculating the ratio of the desired radius to the circumference of the earth and then multiplying it by 360 (number of degrees around the earths circumference).  This issue here was that it was only multiplied by 180 making the result out by a factor of 2.  Also made the test for circles actually check to make sure it has the correct centre and radius.

Closes #7301
2014-08-20 16:23:21 +01:00
uboness e2311d5da4 opened up getting the template name from DeleteIndexTemplateRequest 2014-08-20 07:11:15 -07:00
javanna 61da463dd0 Internal: adjusted internal requests visibility from public to package private 2014-08-20 12:11:57 +02:00
javanna 3450e82855 [TEST] UnicastBackwardsCompatibilityTest should not copy internal node settings to external nodes
Recent test failures triggered by #7289 were caused by this, simply because internal node settings (transport type key) that are not supported by the external older nodes were copied to them by mistake.
2014-08-20 12:01:41 +02:00
Alexander Reelsen 357ab3a9d8 Test: Prevent use of transport client when testing changed transports
This makes sure, that the transport client is not used, as it would use
a different than the configured local transport mechanism in this test.
2014-08-20 08:46:03 +02:00
Igor Motov 45ca7771ee Snapshot checksum verification
Adds automatic verification of all files that are being snapshotted. Closes #5593
2014-08-19 20:58:43 -04:00
Igor Motov 0e5332f86c Fix NPE in SnapshotsService on node shutdown
Fixes #6506
2014-08-19 18:48:39 -04:00
Alexander Reelsen 247ff7d801 Transport: Refactor guice startup
* Removed & refactored unused module code
* Allowed to set transports programmatically
* Allow to set the source of the changed transport

Note: The current implementation breaks BWC as you need to specify a concrete
transport now instead of a module if you want to use a different
Transport or HttpServerTransport

Closes #7289
2014-08-19 18:03:06 +02:00
javanna 7aa2d11cdd Internal: auto create index to keep around headers and context of the request that caused it
Closes #7331
2014-08-19 17:04:13 +02:00
javanna a279f2e8c6 Internal: made it possible to disable the main transport handler in TransportShardSingleOperationAction
TransportShardSingleOperationAction is currently subclassed by different transport actions. Some of them are internal only, meaning that their execution will take place only in the same node where their parent execution took place. That means that their main transport handler doesn't need to be registered, the only transport handler that's needed is the shard level one.

Added `isSubAction` method (defaults to false) to the parent class that tells whether the action is a main one or a subaction, used to decide whether we need to register the main transport handler.

Closes #7285
2014-08-19 17:04:13 +02:00
Martijn van Groningen 9c63abde04 [TEST] Added more assertions 2014-08-19 16:34:54 +02:00
Adrien Grand 0f63e0a8da Aggregations: Merge LongTermsAggregator and DoubleTermsAggregator.
These two aggregators basically do exactly the same thing, they just interpret
bytes differently. This refactoring found an (unreleased) bug in the long terms
aggregator which didn't work correctly with duplicate values.

Close #7279
2014-08-19 15:33:05 +02:00
mikemccand d2ac95d93c Core: DistributorDirectory shouldn't search for directory when reading existing file
This was causing too much work e.g. when pulling node stats or when
opening a new reader, because the least_used distributor would
unnecessarily check free disk space on all path.data entires every
time we try to open a file for reading or check its length.

Closes #7306

Closes #7323
2014-08-19 08:56:06 -04:00
javanna 8458138b8c Internal: get request while percolating existing documents to keep around headers and context of the original percolate request
Closes #7333
2014-08-19 14:32:42 +02:00
javanna b1f532eb85 Internal: changed index templates api category from indices to cluster 2014-08-19 13:43:36 +02:00
Martijn van Groningen 383e64bd5c Aggregations: Add `children` bucket aggregator that is able to map buckets between parent types and child types using the already builtin parent/child support.
Closes #6936
2014-08-19 12:40:51 +02:00
David Pilato 122c2b7a12 Cli: parsing multiple times throws `AlreadySelectedException`
This issue has been fixed in commons-cli:1.3 project which sadly has not been released yet.
See https://issues.apache.org/jira/browse/CLI-183

This patch builds another list of options with no selected groups by default.

When commons-cli:1.3 will be released, we need to remove this patch.

Closes #7282.
2014-08-19 10:55:41 +02:00
mikemccand 81ced48f99 Core: switch to fixed thread pool by default for management threads
Switch management threads to a fixed thread pool with up to 5 threads, and queue size of 100 by default, after which excess incoming requests are rejected.

Closes #7318

Closes #7320
2014-08-18 15:46:29 -04:00
Martijn van Groningen 95a4e699bf [TEST] Don't invoke RoutingNodes.assertShardStats() via asserts many times in tests, just once on each reroute call. 2014-08-18 19:56:04 +02:00
Robert Muir ae326c4232 Tests: tone down random compression tests
Closes #7314
2014-08-18 10:37:45 -04:00
Britta Weber 9addac8300 function_score: remove explanation of query score from functions
The score is explained already, it should not be again explained per function.

Also, remove explanation from parameter list of ScoreFunction#explainScore()
and leave only the score.

This also removes ExplainableSearchScript which is not used anywhere and
was the only reason to have the Explanation in the parameter anyway.

closes #7245
2014-08-18 16:07:00 +02:00
Colin Goodheart-Smithe b2286915cd Geo: Adds support for GeoJSON GeometryCollection
Closes #2796
2014-08-18 13:55:39 +01:00
Colin Goodheart-Smithe 2c69dc06d1 Mapping: Fixes using nested doc array with strict mapping
Closes #7304
2014-08-18 10:19:29 +01:00
Adrien Grand 436e37cd76 Aggregations: Make the list of buckets for terms and histogram returned as a java.util.List.
The terms and histogram aggregations always have an order. So it would make the
response easier to consume to return the buckets as a list instead of a
collection in order to make it easier to do things like getting the first/last
buckets.

Close #7275
2014-08-18 09:25:32 +02:00
Igor Motov 0156bcbf32 Fix failed engine exception logging 2014-08-16 22:09:13 -04:00
uboness 40c63ad07a Fixed a request headers bug in transport client
Where the configured request headers were not sent with sniffing requests (both node/info & cluster state sniffing)
2014-08-16 03:01:14 +02:00
Igor Motov f4115b84a7 Add more logging for testSnapshotAndRestore backward compatibility test 2014-08-15 19:23:19 -04:00
javanna d0e2d768b8 Java api: fixed inconsistencies in PercolateRequest, added return type for method chaining where missing
Closes #7294
2014-08-15 15:57:14 +02:00
Robert Muir 5c7cefa292 Analysis: Add keep_types for filtering by token type 2014-08-15 09:28:12 -04:00
Colin Goodheart-Smithe f4d75f0212 REST API: Allows all options for expand_wildcards parameter
This change means that the default settings for expand_wildcards are only applied if the expand_wildcards parameter is not specified rather than being set upfront. It also adds the none and all options to the parameter to allow the user to specify no expansion and expansion to all indexes (equivalent to 'open,closed')

Closes #7258
2014-08-15 12:50:11 +01:00
Britta Weber d6312178ad [TEST] remove unneeded explain(true)
closes #7248
2014-08-14 15:59:21 +02:00
Britta Weber 9bebccba0c function_score: fix explanation, [ was missing 2014-08-14 15:59:19 +02:00
Adrien Grand feefc41127 [TESTS] Make DisabledFieldDataFormatTests less evil. 2014-08-14 15:26:15 +02:00
Adrien Grand a4f974dcaa Internal: Add some @Nullable annotations and fix related compilation warnings.
Added @Nullable to:
 - IndicesService.indexService
 - IndexService.shard
 - IndexService.shardInjector

This change doesn't try to do anything smart but just makes sure that a
*MissingException is thrown instead of a NullPointerException when the requested
object doesn't exist.

Close #7251
2014-08-14 14:55:52 +02:00
javanna 084793fca7 Internal: fixed wrong version check s/onOrBefore/before in TransportShardSingleOperationAction
relates to #7223
2014-08-14 14:19:37 +02:00
uboness f4a7793f89 Introduced a new elasticsearch exception family that can hold headers
- These heades will be copied as response header on the rest response
2014-08-14 12:34:38 +02:00
Colin Goodheart-Smithe 7602b13a58 Geo: Improved error handling in geo_distance
geo_distance filter now throws a parse exception if no distance parameter is supplied

Close #7260
2014-08-14 10:25:01 +01:00
Alexander Reelsen 6023a3a1a1 Plugins: Add executable flag to every file in bin/ after install
The PluginManager does not preserve permissions on install. This patch
sets the executable flag on every file in bin/ on plugin install.

Closes #7177
2014-08-14 10:53:08 +02:00
javanna 4d05d1d7b0 Internal: adjusted BroadcastShardOperationResponse subclasses visibility
Also replaced int,String pair with ShardId that holds the same info and serializes it the same way.
Replaced shardId and index getters in BroadcastOperationRequest with a single ShardId getter.

Closes #7255
2014-08-13 17:38:18 +02:00
Ryan Ernst 98063ba244 Add [1.3.3] and [1.2.5] version constants. 2014-08-13 08:03:52 -07:00
Lee Hinman fe86eddecb Forbid index names over 100 characters in length
Fixes #4417
2014-08-13 14:51:21 +02:00
Lee Hinman 4dc060527c Add GroovyCollections to the sandbox whitelist
Also clarify in the docs that changing the whitelist/blacklist settings
replace the list, they don't add to it.

Fixes #7089
Fixes #7088
2014-08-13 14:47:49 +02:00
Thomas Peuss 089658a36f A content decompressor that throws a human readable message when
compression is disabled and the user sends compressed content.
2014-08-13 12:25:11 +02:00
javanna ba8df3b5ba Update api & Indices stats: fixed version checks for no-op updates which got in after 1.3 was released
Also added basic bw comp test for indices stats api.

Relates to #6822
2014-08-13 11:45:09 +02:00
David Pilato 90dfb350e0 Tests: move plugin dir to plugins dir
We should be consistent in our naming for classes and resources.
2014-08-13 11:42:05 +02:00
David Pilato 02a90f3684 Fix: VerboseProgress(PrintWriter) does not set the writer 2014-08-13 11:37:05 +02:00
David Pilato 655282a2c6 Remove `numeric_range` filter
As done with #4034, `numeric_range` filter has been deprecated since 1.0.0.

Closes #7108.
2014-08-13 10:19:45 +02:00
javanna 270b109e65 Internal: adjusted visibility to package private for BroadcastShardOperationRequest subclasses and their constructors
Also replaced the String,int pair for index and shard_id with ShardId object that holds the same info and serialized it the same way too.

Closes #7235
2014-08-13 09:51:51 +02:00
Colin Goodheart-Smithe cd4aea841a Geo: fixes computation of geohash neighbours
The geohash grid it 8 cells wide and 4 cells tall. GeoHashUtils.neighbor(String,int,int.int) set the limit of the number of cells in y to < 3 rather than <= 3 resulting in it either not finding all neighbours or incorrectly searching for a neighbour in a different parent cell.

Closes #7226
2014-08-13 08:38:44 +01:00
Colin Goodheart-Smithe 2906d3e6dc Core: Store index creation time in index metadata
This change stores the index creation time in the index metadata when an index is created.  The creation time cannot be changed but can be set as part of the create index request to allow for correct creation times for historical data.

Closes #7119
2014-08-12 21:34:50 +01:00
mikemccand 8e35e921f7 Java client API: CreateIndexRequestBuilder.addMapping throws IllegalStateException if you add same type more than once
Previously, it would silently overwrite the previous mapping, which was trappy.

Closes #7231

Closes #7243
2014-08-12 14:32:38 -04:00
Alexander Reelsen e689a0ad71 Test: Allow CliTool to write out stacktraces
In order to have the possibility of debugging on the command line, the user
now can either set the es.cli.debug system property
which results in stack traces being written to to the terminal.

Closes #7222
2014-08-12 17:43:36 +02:00
David Pilato 9e6868733c Query DSL: Cache range filter on date field by default
A range filter on a date field with a numeric `from`/`to` value is **not** cached by default:

    DELETE /test

    PUT /test/t/1
    {
      "date": "2014-01-01"
    }

    GET /_validate/query?explain
    {
      "query": {
        "filtered": {
          "filter": {
            "range": {
              "date": {
                "from": 0
              }
            }
          }
        }
      }
    }

Returns:

    "explanation": "ConstantScore(no_cache(date:[0 TO *]))"

This patch fixes as well not caching `from`/`to` when using `now` value not rounded.
Previously, a query like:

    GET /_validate/query?explain
    {
      "query": {
        "filtered": {
          "filter": {
            "range": {
              "date": {
                "from": "now"
                "to": "now/d+1"
              }
            }
          }
        }
      }
    }

was cached.

Also, this patch does not cache anymore `now` even if the user asked for caching it.
As it won't be cached at all by definition.

Added as well tests for all possible combinations.

Closes #7114.
2014-08-12 15:27:02 +02:00
David Pilato b72f44b93a [Test] fix plugins: `bin` and `config` only plugins do not install correctly
Related to #7152.
2014-08-12 14:59:22 +02:00
David Pilato 14a028d62c plugins: `bin` and `config` only plugins do not install correctly
When installing a bin only plugin, it is identified as a site plugin.

A current workaround would be to create in the zip file another empty dir. So if you have:

* `bin/myfile.sh`
* `empty/empty.txt`

the `bin` content will be extracted as expected.

Closes #7152.
2014-08-12 14:40:51 +02:00
javanna 0ec7aa4492 [TEST] don't use multiple names (e.g. aliases) pointing to the same concrete index when using indexRandom
indexRandom will try to delete bogus documents multiple times since they get tracked by indexOrAlias/id, and after the actual deletion any other attempt throws error and fails the test
2014-08-12 14:34:11 +02:00
javanna 5d987ad5e2 Internal: changed every single index operation to not replace the index within the original request
An anti-pattern that we have in our code, noticeable for java API users, is that we modify incoming requests by replacing the index or alias with the concrete index. This way not only the request has changed, but all following communications that use that request will lose the information on whether the original request was performed against an alias or an index.

Refactored the following base classes: `TransportShardReplicationOperationAction`, `TransportShardSingleOperationAction`, `TransportSingleCustomOperationAction`, `TransportInstanceSingleOperationAction` and all subclasses by introduced an InternalRequest object that contains the original request plus additional info (e.g. the concrete index). This internal request doesn't get sent over the transport but rebuilt on each node on demand (not different to what currently happens anyway, as concrete index gets set on each node). When the request becomes a shard level request, instead of using the only int shardId we serialize the ShardId that contains both concrete index name (which might then differ ffrom the original one within the request) and shard id.

Using this pattern we can move get, multi_get, explain, analyze, term_vector, multi_term_vector, index, delete, update, bulk to not replace the index name with the concrete one within the request. The index name within the original request will stay the same.

Made it also clearer within the different transport actions when the index needs to be resolved and when that's not needed (e.g. shard level request), by exposing `resolveIndex` method. Moved check block methods to parent classes as their content was always the same on every subclass.

Improved existing tests by randomly introducing the use of an alias, and verifying that the responses always contain the concrete index name and not the original one, as that's the expected behaviour.

Added backwards compatibility tests to make sure that the change is applied in a backwards compatible manner.

Closes #7223
2014-08-12 13:25:23 +02:00
Colin Goodheart-Smithe 371d6021e7 Fix for failing BasePolygonBuilder 2014-08-12 11:04:07 +01:00
Colin Goodheart-Smithe 128b83e4a5 Geo: Better error for invalid multipolygon
Closes #7126
2014-08-12 10:30:26 +01:00
Colin Goodheart-Smithe 7c5a954b93 Geo: fixes geo_shapes which intersect dateline
If a geo_shape had edges which either ran vertically along the dateline or touched the date line but did not cross it they would fail to parse.  This is because the code which splits a polygon along the dateline did not take into account the case where the polygon touched but did not cross the dateline.  This PR fixes those issues and provides tests for them.

Close #7016
2014-08-12 09:54:16 +01:00
javanna 98fa8f9ba4 Internal: adjusted TermVectorRequest serialization to not serialize and de-serialize the index twice
Closes #7221
2014-08-12 10:33:09 +02:00
mikemccand 983c14b41a Test: don't need to wait for concrete mappings since we map both fields when we create the index 2014-08-12 04:24:10 -04:00
Martijn van Groningen a40cb169b6 Mappings: Make sure that multi fields are serialized in alphabetic order to ensure that the source is always the same.
Closes #7215
2014-08-11 18:45:02 +02:00
Martijn van Groningen 565dd90860 Core: Avoid null references that may be returned due to concurrent changes or inconsistent cluster state
Closes #7181
2014-08-11 18:32:26 +02:00
javanna ca5a17e4ba [DOCS] fixed DeleteIndexedScriptResponse javadocs 2014-08-11 17:55:31 +02:00
javanna c2594c0d3b Internal: adjusted visibility of GetRequest members (from protected to private) and resolved warning 2014-08-11 17:55:30 +02:00
Martijn van Groningen 2801d06aee Core: Pass down the types from the delete mapping request to the delete by query request.
The `.percolator` type is a hidden type and therefor the types from the delete mapping request should passed down to the delete by query request, otherwise the percolator type gets ignored and the percolator queries don't get deleted from disk (only unregistered).

Closes #7087
2014-08-11 17:19:03 +02:00
Ryan Ernst c1b6e53cbb Internal: Fix a very rare case of corruption in compression used for
internal cluster communication.

See CorruptedCompressorTests for details on how this bug can be hit.
This change also removes the ability to use the unsafe variant of
ChunkedEncoder, removing support for the compress.lzf.decoder setting.
2014-08-11 07:26:09 -07:00
Adrien Grand bc41190dba [Build] @Nullable annotation is not applied to primitive types. 2014-08-11 15:28:41 +02:00
Colin Goodheart-Smithe 5349ecdb77 Mapping: fixes dynamic mapping of geo_point fields
If a dynamic mapping for a geo_point field is defined and the first document specifies the value of the field as a geo_point array, the dynamic mapping throws an error as the array is broken into individual number before consulting the dynamic mapping configuration.  This change adds a check of the dynamic mapping before the array is split into individual numbers.

Closes #6939
2014-08-11 13:08:32 +01:00
Adrien Grand 1210b08ecb [TEST] Fix SimpleQueryTests.testRangeQuery assumptions.
This test assumed that the `num` field was mapped as an integer on all shards
and thus that all of them should fail when providing a timezone. However, since
it used dynamic mappings, some shards might have this field not mapped, as a
consequence they didn't fail.
2014-08-11 14:00:49 +02:00
javanna a03860970b Internal: refactored TransportSingleCustomOperationAction, subclasses and requests
TransportSingleCustomOperationAction is subclassed by two similar, yet different transport action: TransportAnalyzeAction and TransportGetFieldMappingsAction. Made their difference and similarities more explicit by sharing common code and moving specific code to subclasses:
- moved index field to the parent SingleCustomOperationAction class
- moved the common check blocks code to the parent transport action class
- moved the main transport handler to the TransportAnalyzeAction subclass as it is only used to receive external requests through clients. In the case of the TransportGetFieldMappingsIndexAction instead, the action is internal and executed only locally as part of the user facing TransportGetFieldMappingsAction. The corresponding request gets sent over the transport though as part of the related shard request
- removed the get field mappings index action from the action names mapping as it is not a transport handler anymore. It was before although never used.

Closes #7214
2014-08-11 11:08:38 +02:00
olivier bourgain ac40eae3e3 Core: Improve XContentBuilder API. 2014-08-11 10:40:10 +02:00
javanna c7a9b3da5b Internal: removed needless serialization code from TransportIndexReplicationAction and corresponding request object
TransportIndexReplicationAction is always executed locally, as an internal action that is part of either delete by query or delete (when routing is required but not specified). Only the corresponding shard level requests get sent over the transport, hence no transport endpoint is needed for the index version, nor the index request itself is supposed to be sent over the transport.

Moved classes from org.elasticsearch.action.delete.index to org.elasticsearch.action.delete and adjusted visibility so that internal requests are not public anymore.

Also removed serialization code from IndexDeleteResponse as it never gets sent over transport either.

Closes #7211
2014-08-11 10:02:04 +02:00
Alexander Reelsen fbd337921f Test: Improved CLI testing infrastructure
Added a CaptureOutputTerminal class to the infrastructure, which can be used
in tests, to make sure that CLI commands write out the right data
2014-08-11 09:52:55 +02:00
javanna d01e79429a [TEST] moved testUpdateRequest unit test method to a proper unit test class 2014-08-08 23:26:06 +02:00
Areek Zillur 99ae3066de Suggester: add suggestRequest to Requests and fix broken javadocs in client
closes #7206
2014-08-08 12:09:28 -04:00
mikemccand 5335e3d22d Test: make sure mappings are on all shards to prevent false test failures 2014-08-08 10:51:23 -04:00
Robert Muir 1a09e7180a vary offset/length (i hope) in compressed stream test 2014-08-08 09:54:46 -04:00
javanna 6d3bcc4451 Java API: add index, type and id to ExplainResponse
Index, type and id were returned as part of the REST explain api response, but not through java api. That info was read out of the request, relying on the fact that the index would get overridden with the concrete one within that same request.

Closes #7201
2014-08-08 12:52:03 +02:00
javanna 7f2b18864c Java API: fixed warnings in TermVectorRequest, also called super.validate for index not null check 2014-08-08 12:05:29 +02:00
Robert Muir 5377d03173 Fix BytesStreamInput(BytesReference) ctor with nonzero offset 2014-08-08 03:22:34 -04:00
Ryan Ernst 1386232e1f Test: Add test with mix of ints/longs/strings/bytes to compress. 2014-08-08 00:21:41 -07:00
Alexander Reelsen 724b14cef6 Mapping API: Improve IP address validation
Until now, IP addresses were only checked for four dots, which
allowed invalid values like 127.0.0.111111

This adds an additional check for validation.

Closes #7131
2014-08-08 08:48:38 +02:00
Robert Muir 4e16258648 add multithreaded compressed streams tests 2014-08-08 01:49:00 -04:00
Robert Muir 3f13967c36 remove dead unused code 2014-08-07 20:13:10 -04:00
Robert Muir e8e71e323a move unused code to src/test 2014-08-07 19:36:58 -04:00
Robert Muir 87670c613f ensure we exceed 65k in size sometimes in test 2014-08-07 18:40:47 -04:00
Robert Muir 59aabf30f8 add more evilness to compressed streams test 2014-08-07 18:30:27 -04:00
Martijn van Groningen e4d35c458a [TEST] Associate type with percolate query 2014-08-07 23:51:18 +02:00
Robert Muir d341274457 test some linedocs data with compressed streams 2014-08-07 17:20:41 -04:00
Robert Muir 975327775a test some random bytes with compressed streams 2014-08-07 16:47:36 -04:00
Ryan Ernst 90d2cb7dd5 Internal: Remove (mostly) unused 'failure' member from ShardSearchFailure.
closes #6837
closes #6861
2014-08-07 13:12:54 -07:00
Robert Muir 197ef0b205 test random strings in CompressedStringTests 2014-08-07 15:45:41 -04:00
uboness 1f9bceb5c5 Cleaned up TransportMessage and added transient context to it
- The context enables setting arbitrary transient data on the message (this data is not serialized with the request)
 - Changed header accessors/mutators so header manipulation will be done directly on the request (to void NPE with transport message headers when dealing with maps that can potentially be null)
2014-08-07 17:00:53 +02:00
javanna dbb513f5b0 Java api: remove operationThreaded setter from ExplainRequestBuilder, already available in base class SingleShardOperationRequestBuilder
It also didn't follow the setter convention that we adopted for request builders.
Fixed also javadocs warning caused byt missing descriptions for tag.

Closes #7186
2014-08-07 13:41:57 +02:00
javanna b73b37a8f0 Internal: fixed typo in NodeService s/disovery/discovery 2014-08-06 13:31:11 +02:00
javanna feb3839f0f [TEST] fixed unicast bw comp test configuration
The second internal node, when present, wasn't able to join the existing cluster due ti misconfigured unicast hosts, thus it would form its own cluster.
2014-08-06 13:31:11 +02:00
Adrien Grand 584d2c32dd [TEST] Assert that put mappings requests are acked in GeoMappingTests. 2014-08-06 11:56:20 +02:00
javanna 6f09eb1b06 [TEST] simplified unicast bw comp test
also fixed unchecked warning in CompositeTestCluster
2014-08-06 09:54:53 +02:00
uboness 6f73c93692 Added an option to add arbitrary headers to the client requests
The headers are key/value pairs defined in the settings under the `request.headers` namespace.
2014-08-06 03:33:08 +02:00
mikemccand 06709faff2 Fix false assert trip 2014-08-05 15:47:21 -04:00
Shay Banon f216dc4ab8 [TEST] make sure all shards have docs
we need that in order for refresh to be effective and actually refresh in the second round of indexing, otherwise, it caches a 0 docs shard and a refresh won't expire anything there
2014-08-05 20:28:47 +02:00
Shay Banon e6e2781ee7 [Query Cache] Add a request level flag to control query cache
A request level flag, defaults to be unset, to control the query cache. When not set, it defaults to the index level settings, when explicitly set, will override the index level setting
closes #7167
2014-08-05 18:28:49 +02:00
markharwood e6b459cb9f Update API enhancement - add support for scripted upserts.
In the case of inserts the UpdateHelper class will now allow the script used to apply updates to run on the upsert doc provided by clients. This allows the logic for managing the internal state of the data item to be managed by the script and is not reliant on clients performing the initialisation of data structures managed by the script.

Closes #7143
2014-08-05 16:52:44 +01:00
Shay Banon 418ce50ec4 Query Cache: Support shard level query response caching
The query cache allow to cache the (binary serialized) response of the shard level query phase execution based on the actual request as the key. The cache is fully coherent with the semantics of NRT, with a refresh (that actually ended up refreshing) causing previous cached entries on the relevant shard to be invalidated and eventually evicted.

This change enables query caching as an opt in index level setting, called `index.cache.query.enable` and defaults to `false`. The setting can be changed dynamically on an index. The cache is only enabled for search requests with search_type count.

The indices query cache is a node level query cache. The `indices.cache.query.size` controls what is the size (bytes wise) the cache will take, and defaults to `1%` of the heap. Note, this cache is very effective with small values in it already. There is also the advanced option to set `indices.cache.query.expire` that allow to control after a certain time of inaccessibility the cache will be evicted.

Note, the request takes the search "body" as is (bytes), and uses it as the key. This means same JSON but with different key order will constitute different cache entries.

This change includes basic stats (shard level, index/indices level, and node level) for the query cache, showing how much is used and eviction rates.

While this is a good first step, and the goal is to get it in, there are a few things that would be great additions to this work, but they can be done as additional pull requests:

- More stats, specifically cache hit and cache miss, per shard.
- Request level flag, defaults to "not set" (inheriting what the setting is).
- Allowing to change the cache size using the cluster update settings API
- Consider enabling the cache to query phase also when asking hits are involved, note, this will only include the "top docs", not the actual hits.
- See if there is a performant manner to solve the "out of order" of keys in the JSON case.
- Maybe introduce a filter element, that is outside of the request, that is checked, and if it matches all docs in a shard, will not be used as part of the key. This will help with time based indices and moving windows for shards that fall "inside" the window to be more effective caching wise.
- Add a more infra level support in search context that allows for any element to mark the search as non deterministic (on top of the support for "now"), and use it to not cache search responses.

closes #7161
2014-08-05 17:45:42 +02:00
Alexander Reelsen 35e67c84fa CORS: Allowed to configure allow-credentials header to work via SSL
This adds support to return the "Access-Control-Allow-Credentials" header
if needed, so CORS will work flawlessly with authenticated applications.

Closes #6380
2014-08-05 17:33:06 +02:00
Shay Banon 1d01b2ac6a [TEST] increase ack timeout on large cluster
when we have a small machine running it with randmoized larger number of nodes (5), we need more time to process it
2014-08-05 16:52:46 +02:00
Lee Hinman 8124bcae1e Make "cluster.routing.allocation.allow_rebalance" a dynamic setting
Also makes it a static constant and changes all tests to use it instead
of a string.

Fixes #7092
2014-08-05 16:26:09 +02:00
Shay Banon 9d79848998 [TEST] add explicit options to no master tests 2014-08-05 13:27:19 +02:00
javanna c788a5e67b [TEST} make sure unicast bw comp test uses specifically set transport port and properly configure unicast hosts
Added also assertBusy block needed since we test the local cluster state on each node, not only on the master node.
2014-08-05 11:47:10 +02:00
Colin Goodheart-Smithe 9c89fcf5a2 Aggregations: key_as_string only shown when format specified in terms agg
The key_as_string field is now not shown in the terms aggregation for long and double fields unless the format parameter is specified

Closes #7125
2014-08-05 10:38:59 +01:00
uboness 0da5cecc3c Added custom transport client settings to test infra
It's now possible to define the additional customesettings for transport clients by extending `transportClientSettings` callback method on `ElasticsearchIntegrationTest`.
2014-08-04 23:58:30 +02:00
javanna 74aa35bdcd [TEST] Fixed GetTermVectorTests, added missing break statements in randomization switch 2014-08-04 17:16:10 +02:00
javanna 24a1a0f07f [TEST] Fixed action names bw comp tests, action not found is expected for newly added exists actions 2014-08-04 17:00:40 +02:00
David Pilato 873a45eaba Search: add time zone setting for relative date math in range filter/query
Filters and Queries now supports `time_zone` parameter which defines which time zone should be applied to the query or filter to convert it to UTC time based value.

When applied on `date` fields the `range` filter and queries accept also a `time_zone` parameter.

The `time_zone` parameter will be applied to your input lower and upper bounds and will move them to UTC time based date:

[source,js]
--------------------------------------------------
{
    "constant_score": {
        "filter": {
            "range" : {
                "born" : {
                    "gte": "2012-01-01",
                    "lte": "now",
                    "time_zone": "+1:00"
                }
            }
        }
    }
}

{
    "range" : {
        "born" : {
            "gte": "2012-01-01",
            "lte": "now",
            "time_zone": "+1:00"
        }
    }
}
--------------------------------------------------

In the above examples, `gte` will be actually moved to `2011-12-31T23:00:00` UTC date.

NOTE: if you give a date with a timezone explicitly defined and use the `time_zone` parameter, `time_zone` will be
ignored. For example, setting `from` to `2012-01-01T00:00:00+01:00` with `"time_zone":"+10:00"` will still use `+01:00` time zone.

Closes #3729.
2014-08-04 15:42:03 +02:00
javanna d2fea5378a Transport: better categorization for transport actions
Our transport relies on action names that tell what we need to do with each message received and sent on any node, together with the content of the request itself.
The action names could use a better categorization and more consistent naming though, the following are the categories introduced with this commit:

- indices: for all the apis that execute against indices
  - admin: for the apis that allow to perform administration tasks against indices
  - data: for the apis that are about data
    - read: apis that read data
    - write: apis that write data
    - benchmark: apis that run benchmarks

- cluster: for all the cluster apis
  - admin: for the cluster apis that allow to perform administration tasks
  - monitor: for the cluster apis that allow to monitor the system

- internal: for all the internal actions that are used from node to node but not directly exposed to users

The change is applied in a backwards compatible manner: we keep the mapping old-to-new action name around, and when receiving a message, depending on the version of the node we receive it from, we use the received action name or we convert it to the previous version (old to new if version < 1.4). When sending a message, depending on the version of the node we talk to, we use the updated action or we convert it to the previous version (new to old if version < 1.4).
For the cases where we don't know the version of the node we talk to, namely unicast ping, transport client nodes info and transport client sniff mode (which calls cluster state), we just use a lower bound for the version, thus we will always use the old action name, which can be understood by both old nodes and new nodes.

Added test that enforces known updated categories for transport action names and test that verifies all action names have a pre 1.4 version for bw compatibility

Added backwards compatibility tests for unicast and transport client in sniff mode, the one for the ordinary transport client (which calls nodes info) is implicit as it's used all the time in our bw comp tests.
Added also backwards comp test that sends an empty message to any of the registered transport handler exposed by older nodes and verifies that what gets back is not ActionNotFoundTransportException, which would mean that there is a problem in the actions mappings.

Added TestCluster#getClusterName abstract method and allow to retrieve externalTransportAddress and internalCluster from CompositeTestCluster.

Closes #7105
2014-08-04 15:24:16 +02:00
mikemccand a58d9a1dd0 Core: simultaneous create/delete against same id can cause silently inconsistent replica
If simultaneous create & delete operations arrive against the same id,
it's possible that primary and replica see those operations in
different orders, which may result in replica throwing
DocumentAlreadyExistsException when the primary didn't which would
lead to replica being inconsistent (missing a document that primary
had indexed).

This push fixes the issue, by never throwing DAEE from the replica on
create.

Closes #7146 #7142
2014-08-04 09:14:09 -04:00
javanna 8989d062cd MultiGet & MultiTermVector api: fail when using no routing and an alias to an index that has routing required (for that doc type)
Made sure that the routing required check is performed against the concrete index, added use of aliases to existing routing tests.

Taken the change to unify the failure message as well to this form: routing is required for [" + index + "]/[" + type + "]/[" + id + "]

Closes #7145
2014-08-04 14:19:19 +02:00
Shay Banon 5795e4fbd7 [TEST] better failure message when back location is missing 2014-08-04 12:50:37 +02:00
Martijn van Groningen c8cc59df57 Percolator should cache index field data instances.
Before the index reader used by the percolator didn't allow to register a CoreCloseListener, but now it does, making it safe to cache index field data cache entries.
Creating field data structures is relatively expensive and caching them can save a lot of noise if many queries are evaluated in a percolator call.

Closes #6806
Closes #7081
2014-08-04 10:23:34 +02:00
Britta Weber 5706858722 Add parameter to GET for checking if generated fields can be retrieved
Fields of type `token_count`, `murmur3`, `_all` and `_field_names` are generated only when indexing.
If a GET requests accesses the transaction log (because no refresh
between indexing and GET request) then these fields cannot be retrieved at all.
Before the behavior was so:

`_all, _field_names`: The field was siletly ignored
`murmur3, token_count`: `NumberFormatException` because GET tried to parse the values from the source.

In addition, if these fields were not stored, the same behavior occured if the fields were
retrieved with GET after a `refresh()` because here also the source was used to get the fields.

Now, GET accepts a parameter `ignore_errors_on_generated_fields` which has
the following effect:
- Throw exception with meaningful error message explaining the problem if set to false (default)
- Ignore the field if set to true
- Always ignore the field if it was not set to stored

This changes the behavior for `_all` and `_field_names` as now an Exception is thrown if a user
tries to GET them before a `refresh()`.

closes #6676
closes #6973
2014-08-04 08:15:34 +02:00
Britta Weber a3cefd919e significant terms: add google normalized distance, add chi square
closes #6858
2014-08-04 08:15:26 +02:00
uboness b667bcdedf fixed platform independent line separator in CliToolTests 2014-08-02 21:02:22 +02:00
Shay Banon 95762e8126 Support "default" for tcpNoDelay and tcpKeepAlive
Allow to set the value default to network.tcp.no_delay and network.tcp.keep_alive so they won't be set at all, since on solaris, setting tcpNoDelay can actually cause failure
relates to #7115
2014-08-02 17:32:41 +02:00
uboness 5ccc7beaf4 Added a cli infrastructure
CliTool is a base class for command-line interface tools (such as the plugin manager and potentially others). It supports the following:
  - single or multi command tool
  - help printing infrastructure (based on help files)
  - consistent mechanism of parsing arguments (based on commons-cli lib)
  - separation of argument parsing and command execution (for easier unit testing)
  - terminal abstraction (will use System.console() when available)
2014-08-02 17:16:27 +02:00
Shay Banon 2d31349ab0 Fix missing break statement causing reroute serialization failure
closes #7135
2014-08-02 16:52:52 +02:00
Areek Zillur b81b240924 [Fix] CompletionMapper throws misleading error on null value
closes #6399
2014-08-01 15:25:05 -04:00
uboness 3c9c9f33e2 Aggregations Added Filters aggregation
A multi-bucket aggregation where multiple filters can be defined (each filter defines a bucket). The buckets will collect all the documents that match their associated filter.

This aggregation can be very useful when one wants to compare analytics between different criterias. It can also be accomplished using multiple definitions of the single filter aggregation, but here, the user will only need to define the sub-aggregations only once.

Closes #6118
2014-08-01 16:01:08 +01:00
Adrien Grand d9d5b35be9 Sort: Make `ignore_unmapped` work for cross-index queries.
Close #2255
2014-08-01 15:30:17 +02:00
Lee Hinman db7b6097cc [TEST] check breaker reset after parent trip instead of trip count 2014-08-01 15:18:38 +02:00
javanna d5b6de3295 Removed support for aliases as part of index settings
Now that we have explicit support for aliases when creating indices and as part of index templates, we may remove support for aliases (only names) as part of index settings. This is partially breaking as the following calls:

curl -XPUT localhost:9200/index -d '{
  "settings" : {
    "aliases" : [ "alias1"]
  }
}

and

curl -XPUT localhost:9200/index -d '{
  "settings" : {
    "index.aliases" : [ "alias1"]
  }
}

were previously supported and will need to be replaced with

curl -XPUT localhost:9200/index -d '{
  "aliases" : {
    "alias1": {}
  }
}

Closes #5545
2014-08-01 13:49:43 +02:00
Skye Book 0040ed4f6f Function score query: Add missing whitespace when throwing exception
DecayFunctionParser throws a parse exception with a string containing "scaleand origin", this fixes the spacing issue.
2014-08-01 12:43:26 +02:00
Adrien Grand a9d5c03924 Aggregations: Fix infinite loop in the histogram reduce logic.
The histogram reduce method can run into an infinite loop if the
Rounding.nextRoundingValue value is buggy, which happened to be the case for
DayTimeZoneRoundingFloor.

DayTimeZoneRoundingFloor is fixed, and the histogram reduce method has been
changed to fail instead of running into an infinite loop in case of a buffy
nextRoundingValue impl.

Close #6965
2014-08-01 08:58:10 +02:00
Adrien Grand 99b32901d2 Mappings: Fix `copy_to` behavior on nested documents.
Today, `copy_to` always copies a field to the current document, which is often
wrong in the case of nested documents. For example, if you have a nested field
called `n` which has a sub-field `n.source` whose content should be copied to
`target`, then the latter field should be created in the root document instead
of the nested one, since it doesn't have `n.` as a prefix. On the contrary, if
you configure the destination field to be `n.target`, then it should go to the
nested document.

Close #6701
2014-08-01 08:57:33 +02:00
Areek Zillur 1d581e6286 Search Exists API: Checks if any matching documents exist for a given query
Implements a new Exists API allowing users to do fast exists check on any matched documents for a given query.
This API should be faster then using the Count API as it will:
 - early terminate the search execution once any document is found to exist
 - return the response as soon as the first shard reports matched documents

closes #6995
2014-07-31 15:42:30 -04:00
David Pilato 85eb0ea0e7 Generate timestamp when path is null
Index process fails when having `_timestamp` enabled and `path` option is set.
It fails with a `TimestampParsingException[failed to parse timestamp [null]]` message.

Reproduction:

```
DELETE test
PUT  test
{
    "mappings": {
        "test": {
            "_timestamp" : {
                "enabled" : "yes",
                "path" : "post_date"
            }
        }
    }
}
PUT test/test/1
{
  "foo": "bar"
}
```

You can define a default value for when timestamp is not provided
within the index request or in the `_source` document.

By default, the default value is `now` which means the date the document was processed by the indexing chain.

You can disable that default value by setting `default` to `null`. It means that `timestamp` is mandatory:

```
{
    "tweet" : {
        "_timestamp" : {
            "enabled" : true,
            "default" : null
        }
    }
}
```

If you don't provide any timestamp value, indexation will fail.

You can also set the default value to any date respecting timestamp format:

```
{
    "tweet" : {
        "_timestamp" : {
            "enabled" : true,
            "format" : "YYYY-MM-dd",
            "default" : "1970-01-01"
        }
    }
}
```

If you don't provide any timestamp value, indexation will fail.

Closes #4718.
Closes #7036.
2014-07-31 19:48:22 +02:00
Brian Murphy 6b39aa615e [TEST] Reduce number of updates and wait after 1st NoNodeException. 2014-07-31 18:01:30 +01:00
Britta Weber fe86c8bc88 _geo_distance sort: allow many to many geo point distance
Add computation of disyance to many geo points. Example request:

```
{
  "sort": [
    {
      "_geo_distance": {
        "location": [
          {
            "lat":1.2,
            "lon":3
          },
          {
             "lat":1.2,
            "lon":3
          }
        ],
        "order": "desc",
        "unit": "km",
        "sort_mode": "max"
      }
    }
  ]
}
```

closes #3926
2014-07-31 17:33:45 +02:00
Shay Banon 739e977aa7 cluster block with auto create index bulk action can cause bulk execution to not return
when there is a cluster block (like no master yet discovered), the bulk action doesn't properly catch the exception of inner execute to notify the listener, causing the bulk operation to hang
closes #7086
2014-07-31 16:57:49 +02:00
Martijn van Groningen 5ea6267883 [TEST] All shards should be allocated before snapshotting & restoring 2014-07-31 16:22:24 +02:00
Martijn van Groningen 1c59ae1b99 [TEST] Increased logging and make use of prepareCreate and assertAcked 2014-07-31 16:22:24 +02:00
Shay Banon 521f8b28b5 [TEST] Concurrent percolation more randomized + safe use of rand 2014-07-31 11:56:36 +02:00
Alex Ksikes e3b3b6c055 Term Vectors API: adds support for wildcards in selected fields
This could useful to generate all term vectors or a chosen set of them.

Closes #7061
2014-07-30 17:44:37 +02:00
Alexander Reelsen 2077d4be48 Packaging: Dont remove ancestors on deb removal
The used -p option could result in accidentally deleting more directories
than /var/lib/elasticsearch - so this option was removed

Note: This only happens if the directories are empty, but still isnt needed.

Relates #5770
2014-07-30 15:01:06 +02:00
Lee Hinman f9f8459c79 [TEST] randomize byte size and thread count in breaker tests 2014-07-30 12:02:16 +02:00
mikemccand dbcc4e9255 Test: finish all merges before test returns to side step 'Delete Index failed - not acked' failure 2014-07-29 11:54:45 -04:00
Simon Willnauer 873b491f4e [TEST] Make default flush opertion blocking 2014-07-29 13:48:50 +02:00
Simon Willnauer af5b2ae28a [TEST] wait for yellow after index was created in BWC tests 2014-07-29 13:48:42 +02:00
Adrien Grand d67e013e08 [TESTS] Don't create an unclosed threadpool in BigArraysTests. 2014-07-29 13:26:53 +02:00
Lee Hinman 5aa2d0cf61 Add support for the `_name` parameter to the simple_query_string query 2014-07-29 12:41:41 +02:00
Lee Hinman 36cf595367 [TESTS] spin in a loop checking request breaker, because multiple clusters could be running 2014-07-29 11:26:34 +02:00
javanna 91c4824a0f Transport client: don't add listed nodes to connected nodes list in sniff mode
This commit effectively reverts e1aa91d , as it is not needed anymore to add the original listed nodes. The cluster state local call made will in fact always return at least the local node (see #6811).

There were a couple of downsides caused by putting the original listed nodes among the connected nodes:
1) in the following retries, they weren't seen as listed nodes anymore, thus the light connect wasn't used
2) among the connected nodes some were "bad" duplicates as they are already there and don't contain all needed info for each node. This was causing serialization problems for instance given that the node version was missing on the `DiscoveryNode` object.

Closes #7067
2014-07-28 21:48:03 +02:00
javanna fcf4d5a38d Transport Client: fixed the node retry mechanism which could fail without trying all the connected nodes
The RetryListener was notified twice for each single failure, which caused some additional retries, but more importantly was making the client reach the maximum number of retries (number of connected nodes) too quickly, meanwhile ongoing retries which could succeed were not completed yet.

The TransportService used to throw ConnectTransportException due to throwConnectException set to true, and also notify the listener of any exception received from a separate thread through the request holder.

Simplified exception handling by just removing the throwConnectException option from the TransportService, used only in the transport client. The transport client now relies solely on the request holder to notify of failures and eventually retry.

Closes #6829
2014-07-28 20:34:46 +02:00
Simon Willnauer eecbf8a559 Add [1.3.2] version constant 2014-07-28 17:22:18 +02:00
Lee Hinman a93ee599d3 [TESTS] fix circuit breaker tests for remote clusters and bwc
Adds additional version checks in NodeStats for older versions

When using an external cluster (backwards compatibility tests), the act
of checking the request breaker requires a network buffer, which
increments the breaker. This change only checks the request breaker in
InternalTestCluster and uses Guice to retrieve it instead of
a (possible) network request.

Also removed the now unused InternalCircuitBreakerService class
2014-07-28 17:18:24 +02:00
javanna 4e5ad568bb Rest: fixed filters execution order to be from lowest to highest rather than the other way around
Closes #7019
2014-07-28 16:54:42 +02:00
javanna 0e9594e02d Internal: use AtomicInteger instead of volatile int for the current action filter position
Also improved filter chain tests to not rely on execution time, and made filter chain tests look more similar to what happens in reality by removing multiple threads creation in testTooManyContinueProcessing (something we don't support anyway, makes little sense to test it).

Closes #7021
2014-07-28 16:54:42 +02:00
David Pilato 264d59c3e2 Plugin Lucene version checker: use `Lucene.parseVersionLenient`
With commit 07c632a2d4dbefe44e8f25dc4ded6cf143d60e41, we now have a new Lucene.parseVersionLenient(String, Version) method which tries to find an existing Lucene version based on the two first digits X.Y of X.Y.Z String.
2014-07-28 16:38:44 +02:00
Colin Goodheart-Smithe 162200f6ed Aggregations: Stops direct subclassing of InternalNumericMetricsAggregation
Must subclass either InternalNumericMetricsAggregation.SingleValue or InternalNumericMetricsAggregation.MultiValue
2014-07-28 14:13:23 +01:00
Itamar Syn-Hershko dd0b42838d [QUERY] Separate parsing impl from setter in SearchParseElement
This commit makes it easier to reuse the inner highlighting, fetch
and rescore parsing logic by plugins or other internal parts.

Closes #3602
2014-07-28 14:53:04 +02:00
Simon Willnauer d403e68f43 add missing import 2014-07-28 14:33:51 +02:00