Commit Graph

7129 Commits

Author SHA1 Message Date
Simon Willnauer 5d4db0edde Remove accidential modification 2015-05-15 17:03:45 +02:00
Simon Willnauer 9f81ae4845 Merge branch 'master' into feature/translog_checkpoints
Conflicts:
	src/main/java/org/elasticsearch/action/termvectors/TermVectorsFields.java
2015-05-15 17:01:23 +02:00
Michael McCandless a42d92df21 Small fixes:
- rename one method
  - move "generation == null" check under existing "if (createNew == false)"
  - fix typo/whitespace
  - add a TODO
2015-05-15 10:47:17 -04:00
Adrien Grand c5e74a8d72 Merge pull request #11141 from jpountz/fix/fieldnameanalyzer_leniency
Mappings: Make FieldNameAnalyzer less lenient.
2015-05-15 16:41:44 +02:00
Adrien Grand bf599d68dd Merge pull request #11042 from jpountz/feature/aggs_missing
Aggs: Make it possible to configure missing values.
2015-05-15 16:33:29 +02:00
Adrien Grand 32e23b9100 Aggs: Make it possible to configure missing values.
Most aggregations (terms, histogram, stats, percentiles, geohash-grid) now
support a new `missing` option which defines the value to consider when a
field does not have a value. This can be handy if you eg. want a terms
aggregation to handle the same way documents that have "N/A" or no value
for a `tag` field.

This works in a very similar way to the `missing` option on the `sort`
element.

One known issue is that this option sometimes cannot make the right decision
in the unmapped case: it needs to replace all values with the `missing` value
but might not know what kind of values source should be produced (numerics,
strings, geo points?). For this reason, we might want to add an `unmapped_type`
option in the future like we did for sorting.

Related to #5324
2015-05-15 16:26:58 +02:00
Adrien Grand 3e215e720a Merge pull request #11144 from jpountz/fix/remove_hppc_esoteric_dep
Internal: remove dependency on hppc:esoteric.
2015-05-15 16:25:51 +02:00
Martijn van Groningen 719252a138 Merge pull request #11183 from martijnvg/parent-child/remove_id_cache_from_stats_and_clear_cache_apis
Removed `id_cache` from stats and cat apis.
2015-05-15 14:39:35 +02:00
Martijn van Groningen ece18f162e Removed `id_cache` from stats and cat apis.
Also removed the `id_cache` option from the clear cache api.

Closes #5269
2015-05-15 14:06:18 +02:00
Jun Ohtani 3a1a4d3e89 Analysis: Add multi-valued text support
Add support array text as a multi-valued for AnalyzeRequestBuilder
Add support array text as a multi-valued for Analyze REST API
Add docs

Closes #3023
2015-05-15 20:01:10 +09:00
Adrien Grand 66921ffa50 Remove unused docidset-related code. 2015-05-15 12:33:19 +02:00
Britta Weber 7a8d08a4a3 Merge remote-tracking branch 'origin/master' into feature/synced_flush 2015-05-15 10:35:36 +02:00
Britta Weber 36e6718bf5 some more docs and cleanup 2015-05-15 10:35:15 +02:00
Alexander Reelsen f05808d59e HttpServer: Support relative plugin paths in configuration
When specifying relative paths on startup, handling plugin
paths failed due to recently added security fix. This fix
ensures normalization of the plugin path as well.

In addition a new matcher has been added to easily check for a
status code of an HTTP response likes this

assertThat(response, hasStatus(OK));

Closes #10958
2015-05-15 08:40:40 +02:00
Simon Willnauer 50c771be29 [ENGINE] Signal when a new index is created also in Translog creation code
Clarify when a new tranlog should be created by passing the
same create flag to the IndexWriter as well as to the Translog creation
2015-05-15 08:31:56 +02:00
Nicholas Canzoneri 8831ae6e5c Add index name to log statements when settings update fails
When an index setting is invalid and fails to be set, a WARN statement
is logged but it doesn't contain the index name, making tracking down
and fixing the problem more difficult. This commit adds the index name
to the log statement.
2015-05-14 18:44:48 -04:00
Ryan Ernst 91aeea9c66 Make highlighter check source enabled again instead of source complete...for now. 2015-05-14 15:21:07 -07:00
Areek Zillur ac4942b5a7 [TEST] improve Phrase Collate filter test 2015-05-14 18:16:03 -04:00
Ryan Ernst 7cacfa0769 Change includes/excludes back to null based for now, since it
complicates serialization and causes a number of test failures.
2015-05-14 14:58:06 -07:00
Ryan Ernst a6b0f0a8c1 Merge pull request #11171 from rjernst/fix/11116
Mappings: Add back support for enabled/includes/excludes in _source
2015-05-14 14:41:47 -07:00
Ryan Ernst 0e14c6d256 Fix includes/excludes to be handled on merge conflict checking when they
are null
2015-05-14 14:36:26 -07:00
Areek Zillur 7efc43db25 Re-structure collate option in PhraseSuggester to only collate on local shard.
Previously, collate feature would be executed on all shards of an index using the client,
this leads to a deadlock when concurrent collate requests are run from the _search API,
due to the fact that both the external request and internal collate requests use the
same search threadpool.

As phrase suggestions are generated from the terms of the local shard, in most cases the
generated suggestion, which does not yield a hit for the collate query on the local shard
would not yield a hit for collate query on non-local shards.

Instead of using the client for collating suggestions, collate query is executed against
the ContextIndexSearcher. This PR removes the ability to specify a preference for a collate
query, as the collate query is only run on the local shard.

closes #9377
2015-05-14 17:21:53 -04:00
Simon Willnauer 08d7638ed1 apply review comments 2015-05-14 22:57:53 +02:00
Areek Zillur af6b69e791 Ensure empty completion entries are never indexed
closes #10987
2015-05-14 16:48:49 -04:00
Ryan Ernst d31ce43452 Mappings: Add back support for enabled/includes/excludes in _source
This adds back the ability to disable _source, as well as set includes
and excludes. However, it also restricts these settings to not be
updateable. enabled was actually already not modifiable, but no
conflict was previously given if an attempt was made to change it.

This also adds a check that can be made on the source mapper to
know if the the source is "complete" and can be used for
purposes other than returning in search or get requests. There is
one example use here in highlighting, but more need to be added
in a follow up issue (eg in the update API).

closes #11116
2015-05-14 13:04:39 -07:00
Jack Conradson df59288b72 Fixed a broken import in MultiValueMode. 2015-05-14 09:53:26 -07:00
Jack Conradson a5c0ac0d67 Scripting: Add Multi-Valued Field Methods to Expressions
Add methods to operate on multi-valued fields in the expressions language.
Note that users will still not be able to access individual values
within a multi-valued field.

The following methods will be included:

* min
* max
* avg
* median
* count
* sum

Additionally, changes have been made to MultiValueMode to support the
new median method.

closes #11105
2015-05-14 08:27:24 -07:00
Simon Willnauer 91cfba3485 move reading opSize into the catch block to transform EOF into TruncatedTranslogException 2015-05-13 21:12:54 +02:00
Simon Willnauer 19155d8fd8 Simplify new translog creation - pending files are not needed anymore 2015-05-13 20:52:59 +02:00
Robert Muir c949ce00e8 Add test group for third-party tests 2015-05-13 14:34:53 -04:00
Simon Willnauer 96df7ba7eb Applied review comments from @mikemccand
- Renamed TranslogSnapshot to MultiSnapshot
 - moved legacy logic for trucation into LegacyTranslogReaderBase
 - made several methods private and pkg private where applicable
 - renamed arguments for consistency
2015-05-13 20:32:25 +02:00
Britta Weber 5eafc9198f rename as requested by Luca 2015-05-13 18:06:59 +02:00
Britta Weber 3a9c2bd639 fix test 2015-05-13 18:05:32 +02:00
Britta Weber 2b03a03c0c Merge remote-tracking branch 'origin/master' into feature/synced_flush 2015-05-13 18:00:18 +02:00
Robert Muir 33fd25083e Merge pull request #11134 from rmuir/tests_config
Add tests.config support to BootstrapForTesting
2015-05-13 11:35:16 -04:00
Adrien Grand b64e54c424 Merge pull request #11137 from jpountz/enhancement/geo_queries
Query DSL: Make geo filters queries.
2015-05-13 17:27:15 +02:00
Britta Weber 471cd54e39 fix api hangs if no shards allocated 2015-05-13 17:05:29 +02:00
Simon Willnauer 869baeea0c Don't throw an exception if repositories are unregister with match all
Today we barf if repositories are unregistered with a `*` pattern. This
happens on almost every test and adds weird log messages. I dont' think
we should barf in that case.

Closes #11113
2015-05-13 17:01:04 +02:00
Simon Willnauer 6a43fe348d Fail recovery if retry recovery if resetRecovery fails
This might fail if the shard is closed for instance. This will leak
a shard lock causing the shard being locked on this node forever.
2015-05-13 16:47:18 +02:00
javanna add18a5c99 Java api: remove duplicated buildAsBytes and corresponding toString methods
We have some builders, specifically query builders, `SearchSourceBuilder`, `QuerySourceBuilder` and `SuggestBuilder`, that implement `ToXContent` and also allow to build their content as bytes by simply creating a `BytesReference` that holds their json (or yaml etc.) content (`buildAsBytes` methods). They can also print out their content through `toString`. Made sure that those common methods are in one single place and reused where needed.

Also, merged `QueryBuilder` and `BaseQueryBuilder` and made `QueryBuilder` an abstract class instead of an interface.

Closes #11063
2015-05-13 16:14:16 +02:00
Simon Willnauer 807b3c6b95 [TEST] Add basic unittest like tests for SyncedFlushService
This commit adds a SingleNodeTest that runs through the different fialure szenarios
on a single shard to test the basic operations.
2015-05-13 16:05:34 +02:00
javanna d2765a2e26 Java api: add missing rewrite parameter to FuzzyQueryBuilder
We parse the rewrite field in FuzzyQueryParser but we don't allow to set it via FuzzyQueryBuilder for our java api users. Added missing field and setter.

Closes #11130
Closes #11139
2015-05-13 15:46:57 +02:00
Britta Weber f1948cf95c doc for seal api and doc for syned flush in general 2015-05-13 15:43:05 +02:00
Britta Weber c628d67f9e api for synced flush
closes #11098
2015-05-13 14:45:24 +02:00
Adrien Grand 5c9c4776cd Internal: remove dependency on hppc:esoteric.
The esoteric classifier contains in particular maps that take bytes or doubles
as keys. In the byte case, we can just use integer, and in the double case we
can use their long bits instead.
2015-05-13 14:13:10 +02:00
Dawid Weiss 491b00c4ec Updating to HPPC-0.7.1
Close #11035
2015-05-13 13:53:14 +02:00
Simon Willnauer 43ff544117 Add translog checkpoints to prevent translog corruption
Today we are almost intentionally corrupt the translog if we loose
a node due to powerloss or similary disasters. In the translog reading
code we simply read until we hit an EOF exception ignoring the rest of the
translog file once hit. There is no information stored how many records
we are expecting or what the last written offset was.

This commit restructures the translog to add checkpoints that are written
with every sync operation recording the number of synced operations as well
as the last synced offset. These checkpoints are also used to identify the actual
transaction log file to open instead of relying on directory traversal.

This change adds a significant amount of additional checks and pickyness to the translog
code. For instance is the translog now associated with a specific engine via a UUID that is
written to each translog file as part of it's header. If an engine opens a translog file it
was not associated with the operation will fail.

Closes to #10933
Relates to #11011
2015-05-13 12:40:35 +02:00
Adrien Grand 472cc0af08 Merge pull request #11142 from jpountz/feature/bool_filter
Query DSL: Add `filter` clauses to `bool` queries.
2015-05-13 12:25:32 +02:00
Adrien Grand 630757906a Query DSL: Add `filter` clauses to `bool` queries.
These clauses filter the document space without affecting scoring and map to
Lucene's BooleanClause.Occur.FILTER. The `filtered` query is now deprecated and

```json
{
  "filtered": {
    "query": { //query },
    "filter": { //filter }
  }
}
```
should be replaced with
```json
{
  "bool": {
    "must": { //query },
    "filter": { //filter }
  }
}
```
2015-05-13 12:04:56 +02:00
Shay Banon ba20d4b6ba [TEST] fix unintended relocation 2015-05-13 11:18:28 +02:00
Adrien Grand 36884807b3 Merge pull request #11120 from jpountz/fix/bool_parsing
Query DSL: Fix `bool` parsing.
2015-05-13 11:09:12 +02:00
Adrien Grand 11db3170cd Query DSL: Fix `bool` parsing.
In #10985 I introduced a bug that should clauses are parsed as filters while
must_not clauses should be parsed as filters.
2015-05-13 11:08:36 +02:00
Adrien Grand 44e9b75296 Mappings: Make FieldNameAnalyzer less lenient.
In case FieldNameAnalyzer does not find an explicit analyzer for a given
field name, it returns the default analyzer. This behaviour can hide bugs
where the analyzer fails to be propagated to FieldNameAnalyzer or an
analyzer is requested for a field which is not mapped.
2015-05-13 11:01:38 +02:00
Simon Willnauer 6046ecbab3 Prevent PercolateResponse from serializing negative VLong
We are using a a VLong to serialize the PercolateResponse#tookInMillis. This
can due to several `System.currentTimeMillis()` implemenation details be negative.
We should prevent the negavite value for being serialized as a VLong and make sure
we use a valid value for this in the first place

Closes #11138
2015-05-13 10:22:08 +02:00
Adrien Grand f22935b1a8 Query DSL: Make geo filters queries.
This commit replaces geo filters with queries that support two-phase iteration.
2015-05-13 09:10:49 +02:00
Ryan Ernst f766b260ba Add tests for includeInObject backcompat 2015-05-12 23:11:15 -07:00
Ryan Ernst 565ffb16f1 Mappings: Remove ability to set meta fields inside documents
A few meta fields can currently be set within a document's source.
However, the recommended way to set meta fields like this is through
the api, and setting within the document can be a performance trap
(e.g. needing to find _id in order to route the document).

This change removes the ability to set meta fields within
a document source for 2.0+ indexes.

closes #11051
closes #11074
2015-05-12 23:09:03 -07:00
Robert Muir 5deba7264c Add tests.config support to BootstrapForTesting
Several plugins (e.g. elasticsearch-cloud-aws, elasticsearch-cloud-azure, elasticsearch-cloud-gce)
have integration tests that run with actual credentials to a remote service, so test runs
need access to this file.

These all require the tester (or jenkins) to supply the file with -Dtests.config.
2015-05-12 21:23:17 -04:00
Robert Muir 4473bb4275 Remove unnecessary permissions. 2015-05-12 19:15:59 -04:00
Lee Hinman 990c3a9093 Merge remote-tracking branch 'dakrone/acquire-write-lock-on-delete' 2015-05-12 13:23:09 -06:00
Lee Hinman f7e8d7c024 [CORE] Acquire IndexWriter's `write.lock` lock before shard deletion
In `NodeEnvironment.deleteShardDirectoryUnderLock`, we will now attempt
to acquire, then release, the `write.lock` file for the Lucene index in
question to ensure that no other `IndexWriter` has the directory open
before deleting the data.

Note that the `write.lock` file must be released before the actual
deletion in order to allow the directory to be deleted.

Fixes #11097
2015-05-12 13:19:29 -06:00
Robert Muir 262555079c Merge pull request #11106 from rmuir/symlink
Improve path mgmt on init, better error messages, symlink support
2015-05-12 14:21:19 -04:00
Adrien Grand 6936577c6e Query DSL: Make the script filter a query.
This change changes the script filter so that it produces scorers with two-phase
iteration support instead of doc id sets with random-access.
2015-05-12 19:20:37 +02:00
Britta Weber e6f5fb82f0 Merge remote-tracking branch 'origin/master' into feature/synced_flush 2015-05-12 14:50:42 +02:00
Britta Weber 24ffcc28ac fix merge conflict in javadoc 2015-05-12 14:40:56 +02:00
Simon Willnauer a7abe0a324 Make synced flush attemp async to run it easily from a TransportAction
Today we enforce blocking which doesnt' really fit in the elasticsearch model
this commit adds async execution to the synced flush service by passing a
ActinListener to the service returing immediately.
2015-05-12 11:54:56 +02:00
markharwood 89b95dccc8 Aggregations enhancement - remove pointless term frequency lookups.
If the user has set a shard_min_doc_count setting then avoid looking up background frequencies if the term fails to meet the foreground threshold on a shard.

Closes #11093
2015-05-12 08:45:17 +01:00
Simon Willnauer 236f6ccad7 [TEST] Reduce likelyness of sync on every operation 2015-05-12 09:32:12 +02:00
Robert Muir d1defef69d Properly handle the case where symlinks are supported, but
the user is not a windows administrator (can throw IOE in this case)
2015-05-12 00:53:51 -04:00
Robert Muir 019a9410a3 SecurityBootstrap -> BootstrapForTesting, and make less things public 2015-05-12 00:34:02 -04:00
Robert Muir 2cea5f2b38 Improve path management on init:
* Properly support symlinks (e.g. /tmp -> /mnt/tmp)
* Check all configured paths up front and deliver the best exception we can when things are wrong
* Initialize securitymanager earlier
* Fix too-loud error logging of Natives root check
2015-05-12 00:20:52 -04:00
Robert Muir 7c2a8dfb9e Merge pull request #11104 from rmuir/generate_paths
Generate access to tests paths like other paths.
2015-05-11 18:32:26 -04:00
Robert Muir 3ccdde7e2a Generate access to tests paths like other paths. 2015-05-11 18:04:14 -04:00
Ryan Ernst e7618b8528 Settings: Remove file based index templates
As a follow up to #10870, this removes support for
index templates on disk. It also removes a missed
place still allowing disk based mappings.

closes #11052
2015-05-11 12:51:22 -07:00
gmarz 6dcd5bf618 [TEST] Mlockall: Removing assertTrue until we have the proper test infra 2015-05-11 13:51:59 -04:00
Britta Weber 571feec451 Merge remote-tracking branch 'origin/master' into feature/synced_flush 2015-05-11 18:21:36 +02:00
gmarz 852482844c [TEST] Only check if mlockall succeeds on Windows for now 2015-05-11 12:12:32 -04:00
Michael McCandless 08f7caa56b Use System.nanoTime when measuring elapsed time
System.currentTimeMillis is more vulnerable when the clock shifts.

Closes #11058
2015-05-11 11:24:04 -04:00
gmarz cc3f02c0a0 [TEST] Fix mlockall test when running on Windows 2015-05-11 11:09:15 -04:00
gmarz 4fc08aa019 Revert "Revert "VirtualLock implementation for Windows (mlockall equivalent)""
This reverts commit 5dc8b99365.
2015-05-11 10:17:28 -04:00
Robert Muir 4b345ca78f Merge pull request #11069 from rmuir/ban_pathutils
Ban PathUtils.get (for now, until we fix the two remaining issues)
2015-05-11 08:52:45 -04:00
Colin Goodheart-Smithe 671e3ef074 Aggregations: Fix geo bounds aggregation when longitude is 0
When the longitude is zero for a document, the left and right bounds do not get updated in the geo bounds aggregation which can cause the bounds to be returned with Infinite values for longitude

Closes #11085
2015-05-11 13:43:13 +01:00
Colin Goodheart-Smithe 75ea807e63 [TEST] Remove ScriptTransformBackwardsCompatibilityTests 2015-05-11 11:01:48 +01:00
javanna d7e585ca4f REST: Unify query_string parameters parsing
There currently are small differences between search api and count, exists, validate query, explain api when it comes to reading query_string parameters.  `analyze_wildcard`, `lowercase_expanded_terms` and `lenient` are only read by the search api and ignored by all other mentioned apis. Unified code to fix this and make sure it doesn't happen again. Also shared some code when it comes to printing out the query as part of SearchSourceBuilder conversion to ToXContent.

Extended REST spec to include all the supported params (some that were already supported weren't listed), and added REST tests (also some basic tests for count and search_exists which weren't tested at all).

Closes #11057
2015-05-11 11:32:59 +02:00
Adrien Grand d577c07768 Internal: close caches after IndicesService. 2015-05-11 11:10:00 +02:00
Simon Willnauer 5578499d61 [TEST] Only corrupt translog header today we can't detecte truncation corruption 2015-05-11 10:34:26 +02:00
Shay Banon 9bd5df1e31 [TEST] use the correct translog setting 2015-05-11 10:24:19 +02:00
Simon Willnauer 5dc8b99365 Revert "VirtualLock implementation for Windows (mlockall equivalent)"
All test runs fail on windowns with this commit.

This reverts commit 6f99f5d5b2.
2015-05-11 09:21:09 +02:00
Simon Willnauer 3f02c989dd [TEST] Fix storeStats tests if extraFS is involved 2015-05-10 20:49:37 +02:00
Britta Weber f7cfafee63 [TEST] enable inline scripting for test 2015-05-10 18:22:17 +02:00
Martijn van Groningen acdd9a5dd9 parent/child: Removed the `top_children` query. 2015-05-10 16:30:19 +02:00
javanna 9e01dedef5 Java api: remove redundant BytesQueryBuilder in favour of using WrapperQueryBuilder internally
BytesQueryBuilder was introduced to be used internally by the phrase suggester and its collate feature. It ended up being exposed via Java api but the existing WrapperQueryBuilder could be used instead. Added WrapperQueryBuilder constructor that accepts a BytesReference as argument.

One other reason why this filter builder should be removed is that it gets on the way of the query parsers refactoring, given that it's the only query builder that allows to build a query through java api without having a respective query parser.

Closes #10919
2015-05-09 15:25:55 +02:00
javanna ba243e7a9d Java api: unify SearchResponse and BroadcastOperationResponse code around shards header
Different responses hold the shards header, search, count, flush etc. The code was duplicated in two different places, centralized in RestActions.
It turns out that only the search response printed out the status field before the reason, which was added to all other broadcast responses too.

Closes #11064
2015-05-09 14:55:28 +02:00
Igor Motov d2844e0210 Internal: prevent injection of unannotated dynamic settings
Dynamic settings has to be injected into constructor with either @ClusterDynamicSettings or @IndexDynamicSettings. If annotations are not specified an empty instance of Dynamic Settings is injected that can lead to difficult to discover errors such as #10614. This commit will make any attempt to inject unannotated dynamic settings to generate a giuce error.
2015-05-08 18:38:58 -04:00
Igor Motov 573cacab54 ThreadPool: make sure no leaking threads are left behind in case of initialization failure
Our ThreadPool constructor creates a couple of threads (scheduler and timer) which might not get shut down if the initialization of a node fails. A guice error might occur for example, which causes the InternalNode constructor to throw an exception. In this case the two threads are left behind, which is not a big problem when running es standalone as the error will be intercepted and the jvm will be stopped as a whole. It can become more of a problem though when running es in embedded mode, as we'll end up with lingering threads or testing an handling of initialization failures.

Closes #9107
2015-05-08 16:16:17 -04:00
Robert Muir 38cccfb057 cleanup and ban temp files going to jvm default location 2015-05-08 15:08:13 -04:00
Robert Muir 51c71c235b Ban PathUtils.get (for now, until we fix the two remaining issues) 2015-05-08 14:42:27 -04:00
gmarz 6f99f5d5b2 VirtualLock implementation for Windows (mlockall equivalent)
Closes #8480
2015-05-08 09:25:16 -04:00
Christoph Büscher acc42d5599 Transport: read/write support for list of strings
Add support for reading and writng string lists to existing StreamInput and StreamOutput class.
2015-05-08 14:24:17 +02:00
Ryan Ernst 748a040764 fix the build, remove usage of old ES specific IAE 2015-05-07 13:13:57 -07:00
Andrew Selden c953e99324 Merge pull request #10864 from aleph-zero/issues/9606
Remove (dfs_)query_and_fetch from the REST API
2015-05-07 12:51:28 -07:00
Simon Willnauer c53bde5c7b [TEST] only roll over translog if we at least add one operation 2015-05-07 21:18:25 +02:00
Adrien Grand 1cb6af7585 Tests: Fix bad parsing of empty filters. 2015-05-07 21:06:23 +02:00
Adrien Grand a0af88e996 Query DSL: Remove filter parsers.
This commit makes queries and filters parsed the same way using the
QueryParser abstraction. This allowed to remove duplicate code that we had
for similar queries/filters such as `range`, `prefix` or `term`.
2015-05-07 20:14:34 +02:00
Ryan Ernst 6dd843426c Mappings: Remove mapper listeners
The mapper listener concept is only now used as a callback to the
MapperService when new fields are added. This change removes the
listeners, instead storing a link to the mapper service in
each doc mapper.
2015-05-07 10:17:52 -07:00
Ryan Ernst f1e0fb6b85 Merge pull request #11027 from rjernst/pr/mapper-subfields
Mappings: Remove traverse functions from Mapper
2015-05-07 08:52:38 -07:00
Alex Ksikes 4787cf701f More Like This: remove percent_terms_to_match
Users should use minimum_should_match instead.

Closes #11030
2015-05-07 14:21:29 +02:00
Britta Weber 00f8dd60fe Merge remote-tracking branch 'origin/master' into feature/synced_flush 2015-05-07 13:40:59 +02:00
Shay Banon 8128f398ca Fix NPE in PendingDelete#toString
closes #11032
2015-05-07 12:36:55 +02:00
Colin Goodheart-Smithe 8905e7297b Merge pull request #10976 from colings86/fix/10926
Allow script language to be null when parsing
2015-05-07 09:46:37 +01:00
Simon Willnauer aa184029b1 Make modifying operations durable by default.
This commit makes create, update and delete operations on an index durable
by default. The user has the option to opt out to use async translog flushes
on a per-index basis by settings `index.translog.durability=request`.

Initial benchmarks running on SSDs have show that indexing is about 7% - 10% slower
with bulk indexing compared to async translog flushes. This change is orthogonal to
the transaction log sync interval and will only sync the transaction log if the operation
has not yet been concurrently synced. Ie. if multiple indexing requests are submitted and
one operations sync call already persists the operations of others only one sync call is executed.

Relates to #10933
2015-05-07 10:14:34 +02:00
Adrien Grand 80be0f7217 Merge pull request #11002 from jpountz/fix/numeric_resolution_string_date
Mappings: `numeric_resolution` should only apply to dates provided as numbers.
2015-05-07 09:39:58 +02:00
Martijn van Groningen f7c29457d0 parent/child: Deprecated the `top_children` in favour of the `has_child` query. 2015-05-07 09:27:54 +02:00
Ryan Ernst 0b31efb328 Mappings: Remove traverse functions from Mapper
The mapper listener abstractions for object and field mappers are used
to notify the mapper service of new fields, as well as collect
all object and field mappers through a set of traversal functions.

This change removes the traversal functions in favor of simple
iteration over subfields of a mapper.
2015-05-06 23:40:07 -07:00
Simon Willnauer 00e9654006 Verify shard state if prepareCreate/prepareIndex fails
This is pretty much a workaround for the fact that we simply
close the downstream resources once the shard is closed. This means
the document parser will barf with NPE or something similar while
AlreadyClosedException would be approriate.
2015-05-07 07:06:54 +02:00
Simon Willnauer 4db689f05e Merge pull request #11018 from brwe/counter-test
[TEST] don't check shard counter if there are still write operations ongoing after test
2015-05-07 06:32:10 +02:00
Britta Weber 790318c65a [TEST] don't check shard counter if there are still write operations ongoing after test 2015-05-06 18:23:26 +02:00
Alex Ksikes ec4f12f9ef More Like This: removal of the MLT API
Removes the More Like This API, users should now use the More Like This query.
The MLT API tests were converted to their query equivalent. Also some clean
ups in MLT tests.

Closes #10736
Closes #11003
2015-05-06 18:11:11 +02:00
Colin Goodheart-Smithe c860c1b437 Merge pull request #11013 from colings86/feature/11007
Adding Sum Bucket Aggregation
2015-05-06 15:50:14 +01:00
Adrien Grand 19a6cb246e Merge pull request #10949 from jpountz/fix/wait_for_mappings_on_primary
Mappings: Wait for mappings to be available on the primary before indexing.
2015-05-06 16:22:37 +02:00
Adrien Grand 8a19bf3aed Mappings: Wait for mappings to be available on the primary before indexing.
In some cases it might happen that a mapping which is already available on the
master node is not available yet on the node that holds the primary shard.
This commit changes indexing on the primary shard so that if a dynamic update
is triggered then the index operation is re-tried until required mappings are
available locally (using cluster state observing).
2015-05-06 16:19:22 +02:00
Colin Goodheart-Smithe cf1251796f Aggregations: Adding Sum Bucket Aggregation
Closes #11007
2015-05-06 14:44:56 +01:00
Zachary Tong e70a8d4ee9 Merge pull request #10964 from polyfractal/feature/aggs_movavg_rename
Rename Moving Average models to their "common" names
2015-05-06 09:07:23 -04:00
Zachary Tong 3eb9cb913d Rename Moving Average models to their "common" names
Previously, we were using the "statistical", technically accurate name.  Instead, we
should probably use the name that people are familiar with, e.g. "Holt Winters" instead
of "triple exponential".  To that end:

- `single_exp` becomes `ewma` (exponentially weighted moving average)
- `double_exp` becomes `holt`

When the `triple_exp` is added, it will be called `holt_winters`.
2015-05-06 09:04:44 -04:00
Colin Goodheart-Smithe 72d99773dc Aggregations: Adding Average Bucket Aggregation
Also includes changes to the other bucket metric aggregations to share code

Closes #11006
2015-05-06 13:53:57 +01:00
Shay Banon 8f163ad4b0 [TEST] Randomize translog settings 2015-05-06 12:23:12 +02:00
Colin Goodheart-Smithe 644fd00714 Aggregations: x-axis units normalisation for derivative aggregation 2015-05-06 10:31:16 +01:00
Adrien Grand c355bd60a4 Mappings: `numeric_resolution` should only apply to dates provided as numbers.
Close #10995
2015-05-06 11:00:53 +02:00
Simon Willnauer 67ed182347 [TEST] Remove unexpected extraFS file check - this was wrongly added before 2015-05-06 10:48:53 +02:00
Ryan Ernst 7a7bd6086a Mappings: Remove ability to disable _source field
Current features (eg. update API) and future features (eg. reindex API)
depend on _source. This change locks down the field so that
it can no longer be disabled. It also removes legacy settings
compress/compress_threshold.

closes #8142
closes #10915
2015-05-05 22:04:18 -07:00
Robert Muir fe5af6f34d Tests: fix test bug (foo -> bar) 2015-05-06 01:03:03 -04:00
Robert Muir 5351fbd8a0 Merge pull request #10997 from rmuir/groovy_better
Load fielddata on behalf of scripts.
2015-05-05 21:26:29 -07:00
Robert Muir 020f7d7195 Load fielddata on behalf of scripts.
If we have to do the one-time loading of fieldata, it requires
more permissions than groovy scripts currently have (zero). This
is because of RamUsageEstimator reflection and so on in PagedBytes.

GroovySecurityTests only test a numeric field, so add a string field
to the test (so pagedbytes fielddata gets created etc).
2015-05-06 00:16:03 -04:00
Robert Muir f613413ce4 Merge pull request #10970 from rmuir/bad_idea
bail if ES is run as root
2015-05-05 17:09:00 -07:00
Robert Muir e4beda94f9 Merge pull request #10983 from rmuir/no_check_certificate
Let HTTPS work correctly
2015-05-05 14:47:37 -07:00
Jack Conradson 9fae152cf5 Scripting: Minor TimeZone Fix
Changed DateMethodFunctionValues to use UTC instead of GMT.  Should
not affect any existing code, but is correct and consistent.

closes #10994
2015-05-05 14:20:54 -07:00
Shay Banon b4b5603617 Merge pull request #10993 from kimchy/sync_interval_not_to_control_type
Use buffered tanslog type also when sync is set to 0
2015-05-05 23:06:11 +02:00
Nicholas Knize 0553001369 [GEO] Remove local lucene spatial package
LUCENE-6422 - PackedQuadTree enhancement - was committed in Lucene 5.2 which is now integrated w/ ES 2.0. This eliminates the need to carry our own local lucene.spatial package. This commit removes the now unnecessary files.
2015-05-05 14:24:31 -05:00
Simon Willnauer 0b256cc629 [TEST] also close wrapped readers 2015-05-05 20:46:07 +02:00
Robert Muir 11394983d9 Merge pull request #10969 from rmuir/grooooooovy
Run groovy scripts with no permissions
2015-05-05 11:36:12 -07:00
Shay Banon ebac29d8a2 Use buffered tanslog type also when sync is set to 0
When settings sync to 0, we benefit from using the buffered type, no need to change to simple, since we get a chance to fsync multiple operations (for that single operation) and not have to sync for the other ones before returning each one
2015-05-05 20:17:36 +02:00
Tanguy Leroux 3976724882 Add pid file to Environment
This commit adds the path of the PID file to the Environment. It also add it to the Security Manager since the PID file is deleted by a shutdown hook when the JVM is exited.
2015-05-05 18:39:19 +02:00
Zachary Tong 4f65130703 [TEST] Fix min/max accumulator in MovAvg tests
Double.MIN_VALUE does not follow the same semantics as Integer.MIN_VALUE.  Namely, it
represents the smallest positive, non-zero value a double can hold.  Since the test uses negative
doubles, this can incorrectly find the min/max metric for a set of values.

Instead, Double.NEGATIVE_INFINITY needs to be used, which represents the smallest value possible.

Not strictly necessary, but MAX_VALUE was switched to POSITIVE_INFINITY just to be 100% correct
2015-05-05 12:29:49 -04:00
Simon Willnauer d20202a963 Remove double exceptin handling that causes false replica failures
we already fail the shard in the `onFailure` method if the replica
operation barfs. This additional check has been added lately that
bypasses the clusterstate observer which causes replicas to fail
if the mappings are not yet present.
2015-05-05 18:04:27 +02:00
Robert Muir afdec4c84c Merge pull request #10989 from rmuir/jna_optional
ensure JNA is fully loaded when its avail, but don't fail its not
2015-05-05 09:03:16 -07:00
Robert Muir 15e6d3ec6c ensure JNA is fully loaded when its avail, but don't fail its not 2015-05-05 11:49:40 -04:00
Britta Weber dc2eed9681 fix after merge with master 2015-05-05 17:45:41 +02:00
Simon Willnauer 200174aa37 Remove Translog interface
We only have one implementation of this interface which makes not much
sense. This commit removes the abstraction.
2015-05-05 17:34:59 +02:00
Britta Weber e3d346d3b7 cleanup 2015-05-05 17:32:03 +02:00
Britta Weber 8349a3ee1e call sync flush when shard is marked as inactive 2015-05-05 17:19:09 +02:00
Robert Muir 9c0d379254 style cleanups (assume and suppressforbidden) 2015-05-05 10:59:39 -04:00
Simon Willnauer fafd67e1ae [TEST] Mute local tests with Java9EA
Relates to #10984
2015-05-05 16:50:57 +02:00
Britta Weber fbc26ca49b implement check for in flight now that we have the counter 2015-05-05 16:15:25 +02:00
Britta Weber 87af6491c9 Merge remote-tracking branch 'origin/master' into feature/synced_flush 2015-05-05 16:15:13 +02:00
Britta Weber 14e5880fea [TEST] don't fail if meta state cannot be loaded
Loading of meta state fails rarely if the state is deleted while we try to load it.
We should try again in this case instead of failing the test.
2015-05-05 15:20:57 +02:00
Robert Muir 13636dcfef Let HTTPS work correctly 2015-05-05 09:14:51 -04:00
Simon Willnauer 00d663f594 [TRANSLOG] Make translog file parsing more picky 2015-05-05 14:11:32 +02:00
Britta Weber 3cda9b2bd7 Write state also on data nodes if not master eligible
When a node was a data node only then the index state was not written.
In case this node connected to a master that did not have the index
in the cluster state, for example because a master was restarted and
the data folder was lost, then the indices were not imported as dangling
but instead deleted.
This commit makes sure that index state for data nodes is also written
if they have at least one shard of this index allocated.

closes #8823
closes #9952
2015-05-05 12:15:40 +02:00
Colin Goodheart-Smithe 12e39a0d5a Scripting: allow script language to be null when parsing
Closes #10926
2015-05-05 11:11:40 +01:00
Simon Willnauer fe5a35b68e Merge branch 'master' into pr-10624
Conflicts:
	src/main/java/org/elasticsearch/index/shard/IndexShard.java
2015-05-05 11:46:02 +02:00
Simon Willnauer 767309265b [ENGINE] Make translog fully private to the engine
This commit moves the translog creation into the InternalEngine
to ensure the transactino log is created after we acquired the write
lock on the index. This also prevents races when ShadowEngines are shutting
down due to node restarts where another node already takes over the not yet
fully synced transaction log.
2015-05-05 11:36:51 +02:00
Colin Goodheart-Smithe 123b0723fe Aggregations: Fixes Infinite values return from geo_bounds with non-zero bucket-ordinals
If the collect method was called with a bucketOrd of > 0 the arrays holding the state for the aggregation would be grown but the initial values for the bucketOrds > 0 were all set to Double.NEGATIVE_INFINITY meaning that for the bottom, posLeft and negLeft values no collected document would change the value since NEGATIVE_INFINITY is always less than every other value.

Closes #10804
2015-05-05 09:58:31 +01:00
Simon Willnauer 1bc159ebf7 mute test in favor of #10972 2015-05-05 10:04:52 +02:00
Robert Muir 6ec6567bad bail if ES is run as root 2015-05-05 01:29:57 -04:00
Robert Muir a7774f2d8b Run groovy scripts with no permissions 2015-05-05 00:33:29 -04:00
Robert Muir d62771ac5d Merge pull request #10965 from rmuir/lockdown4
make testing better mimic reality for securitymanager
2015-05-04 17:06:24 -07:00
Ryan Ernst b889b3b437 Use java sys prop override in tests instead of flag to createPermissions 2015-05-04 15:28:08 -07:00
Shay Banon 187d79b6df Centralize admin implementations and action execution
This change removes the multiple implementations of different admin interfaces and centralizes it with AbstractClient. It also makes sure *all* executions of actions now go through a single AbstractClient#execute method, taking care of copying headers and wrapping listener.
This also has the side benefit of removing all the code around differnet possible clients, and removes quite a bit of code (most of the + code is actually removal of generics and such).

This change also changes how TransportClient is constructed, requiring a Builder to create it, its a breaking change and its noted in the migration guide.

Yea another step towards simplifying the action infra and making it simpler...
2015-05-04 23:40:17 +02:00
Robert Muir 072b90296a Use the special java.ext.dirs path instead of 4 tomcat heuristics 2015-05-04 17:16:08 -04:00
Igor Motov bd453db411 Docs: clarify cluster state handling 2015-05-04 17:00:36 -04:00
Robert Muir 8e8b95faeb fix wrong comment change 2015-05-04 16:30:42 -04:00
Robert Muir 2ed2c4f884 fix permissions bugs 2015-05-04 16:27:24 -04:00
Lee Hinman eabeae980b Merge remote-tracking branch 'dakrone/sharedfs-recovery-any-node' 2015-05-04 14:15:30 -06:00
Lee Hinman 18ab718693 Allow shards on shared filesystems to be recovered on any node
Currently, when all copies of a shard are lost, we reach out to all
other nodes to see whether they have a copy of the data. For a shared
filesystem, though, we can assume that each node has a copy of the data
available, so return a state version of at least 0 for each node.

This feature is set using the dynamic index setting
`index.shared_filesystem.recover_on_any_node`, which defaults to
`false`.

Fixes #10932
2015-05-04 14:03:31 -06:00
Simon Willnauer 7e5c238998 Only mark translog committed in restore recovery 2015-05-04 21:39:17 +02:00
Robert Muir fe046df125 hacky state 2015-05-04 15:38:46 -04:00
Robert Muir 06482e8424 Use Releasables.close here 2015-05-04 14:55:10 -04:00
Robert Muir 2be1a09c77 add a null check for safety 2015-05-04 14:21:11 -04:00
Robert Muir a048f8944b Remove exitVM permission 2015-05-04 14:06:32 -04:00
Zachary Tong babfd8a181 [TEST] Stabilize MovAvgTests with more lenient floating point checks
It appears the previous failure (-Dtests.seed=D9EF60095522804F) is just accumulation of
floating point error differences between expected and actual results.  Making the tests less
stringent by requiring closeTo(0.1) instead of the previous 0.00001
2015-05-04 13:33:20 -04:00
Robert Muir 54d361259e Merge pull request #10962 from rmuir/lockdown2
Remove JNI permissions, improve JNI testing.
2015-05-04 10:22:46 -07:00
Robert Muir b8efa8ea21 Remove JNI permissions, improve JNI testing. 2015-05-04 12:30:03 -04:00
Britta Weber 7bf83ff924 ref count write operations on IndexShard
This commit adds a counter for IndexShard that keeps track of how many write operations
are currently in flight on a shard. The counter is incremented whenever a write request is
submitted in TransportShardReplicationOperationAction and decremented when it is finished.
On a primary it stays incremented while replicas are being processed.
The counter is an instance of AbstractRefCounted. Once this counter reaches 0
each write operation will be rejected with an IndexClosedException.

closes #10610
2015-05-04 18:03:29 +02:00
Ryan Ernst ba68d354c4 Merge pull request #10934 from mattweber/custom_analyzer_pos_offset_gap
document and test custom analyzer position offset gap
2015-05-04 08:56:50 -07:00
Matt Weber 63c4a214db document and test custom analyzer position offset gap 2015-05-04 08:53:45 -07:00
Britta Weber 43eae13c57 use sync id when recovering
Skip phase 1 of recovery in case an identical sync id was found on primary
and replica. Relates to #10032

closes #10775
2015-05-04 17:07:03 +02:00
Simon Willnauer 930eacd457 Merge branch 'master' into pr-10624 2015-05-04 17:06:05 +02:00
Simon Willnauer 29e5f76920 [INDICES] Wait forever (or one day) for indices to close
Today we wait 30 sec for shards to flush and close and then simply exit the process.
This is often not desired and we should by default wait long enough for shards to
close etc. This commit adds a default timeout of one day which simplifies the code
and gives us _enough_ time to shut down.

Closes #10680
2015-05-04 16:56:03 +02:00
Simon Willnauer 10ee8f7793 [ENGINE] Mark current translog as committed if initial recovery is skipped
If the initial recovery is skipped all uncommitted changes are lost. This
must be enforced otherwise primary and replica will go out of sync once the
primary is started after restore and a replica recovers from it applying the
still referenced transaction logs.
2015-05-04 16:26:24 +02:00
Simon Willnauer b5a5bc4f89 [CORE] Allow rebalancing primary shards on shared filesystems
Instead of failing the Engine for a shared filesystem, this change
allows a "soft close" of the Engine, where only the IndexWriter is
closed so that the replica can open an IndexWriter using the same
filesystem directory/mount.

Fixes #10469
2015-05-04 16:26:18 +02:00
Robert Muir 5a701c1f9f remove shutdownHooks permission 2015-05-04 10:18:09 -04:00
Robert Muir 01d6f0dc1d Merge branch 'master' into die_cwd_die
Conflicts:
	src/test/java/org/elasticsearch/client/AbstractClientHeadersTests.java
2015-05-04 09:55:29 -04:00
Britta Weber d6e0ab3a10 Merge remote-tracking branch 'origin/master' into feature/synced_flush 2015-05-04 14:21:15 +02:00
Simon Willnauer 24e73a2c83 [TRANSLOG] Remove channel refcounting for assertions
This refcounting doesn't work for shadow replicas since we open
the same translog file from more than one node while running a rolling
restart. This functionality is also superseeded by our filesystem abstraction
which detects file leaks under the hood.
2015-05-04 14:20:39 +02:00
Robert Muir f042b8f2e1 Merge pull request #10936 from rmuir/eight_point_three
simplify securitymanager init
2015-05-04 04:53:18 -07:00
Simon Willnauer bbffca193c Fail engine if metadata is corrupted on recovery start 2015-05-04 12:18:22 +02:00
Simon Willnauer 7e5f9d5628 Merge branch 'master' into pr-10624
Conflicts:
	src/main/java/org/elasticsearch/index/engine/EngineConfig.java
	src/main/java/org/elasticsearch/index/shard/IndexShard.java
	src/test/java/org/elasticsearch/index/engine/InternalEngineTests.java
	src/test/java/org/elasticsearch/index/engine/ShadowEngineTests.java
2015-05-04 11:37:54 +02:00
Shay Banon b87d360e79 Automatically thread client based action listeners
Today, we rely on the user to set request listener threads to true when they are on the client side in order not to block the IO threads on heavy operations. This proves to be very trappy for users, and end up creating problems that are very hard to debug.
Instead, we can do the right thing, and automatically thread listeners that are used from the client when the client is a node client or a transport client.
This change also removes the ability to set request level listener threading, in the effort of simplifying the code path and reasoning around when something is threaded and when it is not.
closes #10940
2015-05-04 11:05:42 +02:00
Britta Weber 8b7b2f3cdf remove replica response from TransportShardReplicationOperation. not needed anymore 2015-05-04 10:56:34 +02:00
Simon Willnauer 23ac32e616 Remove old 0.90 shard allocator
the `even_shard` allocator has been replaced years ago in early 0.90.
We can remove it now in 2.0 since the new one is considered stable.
2015-05-04 10:48:18 +02:00