Commit Graph

1773 Commits

Author SHA1 Message Date
Colin Goodheart-Smithe 2b94126567 removed obselete NOCOMMIT 2015-09-25 09:57:28 +01:00
Simon Willnauer 64d5ea13d5 Move ShardTermVectorService to be on indices level as TermVectorService
There is no need to have term vectors service on the shard level where it's
created for every shard. This commit moves it to a higher level which makes
shard creation slightly simpler and reduces the number of long living objects.
2015-09-25 10:56:27 +02:00
Christoph Büscher 74d641181e Query Refactoring: validate GeoShapeQueryBuilder strategy and relation parameter
Before the refactoring we didn't check any invalid settings for strategy and relation
in the GeoShapeQueryBuilder. However, using SpatialStrategy.TERM and ShapeRelation.INTERSECTS
together is invalid and we tried to protect against that in the validate() method.

This PR moves these checks to setter for strategy and relation and adds tests for the new
behaviour.

Relates to #10217
2015-09-25 10:52:12 +02:00
Colin Goodheart-Smithe f3b581a6e0 Added ext section to search request for plugins that extend the fetch phase
tested with term vectors fetch
2015-09-25 09:40:16 +01:00
javanna a50a0da183 [TEST] adapt to changes upstream, expression has been moved out
Queries that can include scripts make now use of the mock script engine
2015-09-25 10:20:22 +02:00
javanna 34de79370f Merge branch 'master' into feature/query-refactoring
Conflicts:
	core/src/main/java/org/elasticsearch/ElasticsearchException.java
2015-09-25 09:38:24 +02:00
javanna 4425cd6570 [TEST] fix test bug 2015-09-25 09:16:02 +02:00
Nik Everett fe8f0b97e4 Another formatting fix 2015-09-24 16:50:04 -04:00
Isabel Drost-Fromm 18d3ab381f Switch geo validation to enum 2015-09-24 22:33:08 +02:00
Simon Willnauer 152775c515 Move ShardPercolateService creation into IndexShard
This commit removes an unnecessarily guice injected service and
simply creates an instance where it's needed using plain old java ctors
2015-09-24 21:29:59 +02:00
Robert Muir 8b88a69d9c Block process execution with seccomp on linux/amd64
Block execve(), fork(), and vfork() system calls, returning EACCES instead,
on kernels that support seccomp-bpf: either via seccomp() or falling back
to prctl().

Only linux/amd64 is supported. This feature can be disabled (in case
of problems) with bootstrap.seccomp=false.

Closes #13753

Squashed commit of the following:

commit 92cee05c72b49e532d41be7b16709e1c9f919fa9
Author: Robert Muir <rmuir@apache.org>
Date:   Thu Sep 24 10:12:51 2015 -0400

    Add a note about why we don't parse uname() or anything

commit b427971f45cbda4d0b964ddc4a55fae638880335
Author: Robert Muir <rmuir@apache.org>
Date:   Thu Sep 24 09:44:31 2015 -0400

    style only: we already pull errno into a local, use it for catch-all case

commit ddf93305525ed1546baf91f7902148a8f5b1ad06
Author: Robert Muir <rmuir@apache.org>
Date:   Thu Sep 24 08:36:01 2015 -0400

    add TODO

commit f29d1b7b809a9d4c1fcf15f6064e43f7d1b24696
Author: Robert Muir <rmuir@apache.org>
Date:   Thu Sep 24 08:33:28 2015 -0400

    Add full stacktrace at debug level always

commit a3c991ff8b0b16dc5e128af8fb3dfa6346c6d6f1
Author: Robert Muir <rmuir@apache.org>
Date:   Thu Sep 24 00:08:19 2015 -0400

    Add missing check just in case.

commit 628ed9c77603699aa9c67890fe7632b0e662a911
Author: Robert Muir <rmuir@apache.org>
Date:   Wed Sep 23 22:47:16 2015 -0400

    Add public getter, for stats or whatever if they need to know this

commit 3e2265b5f89d42043d9a07d4525ce42e2cb1c727
Author: Robert Muir <rmuir@apache.org>
Date:   Wed Sep 23 22:43:06 2015 -0400

    Enable use of seccomp(2) on Linux 3.17+ which provides more protection.
    Add nice errors.
    Add all kinds of checks and paranoia.
    Add documentation.
    Add boolean switch.

commit 0e421f7fa2d5236c8fa2cd073bcb616f5bcd2d23
Author: Robert Muir <rmuir@apache.org>
Date:   Wed Sep 23 21:36:32 2015 -0400

    Add defensive checks and nice error messages

commit 6231c3b7c96a81af8460cde30135e077f60a3f39
Author: Robert Muir <rmuir@apache.org>
Date:   Wed Sep 23 20:52:40 2015 -0400

    clean up JNA and BPF. block fork and vfork too.

commit bb31e8a6ef03ceeb1d5137c84d50378c270af85a
Author: Robert Muir <rmuir@apache.org>
Date:   Wed Sep 23 19:00:32 2015 -0400

    order is LE already for the JNA buffer, but be explicit about it

commit 10456d2f08f12ddc3d60989acb86b37be6a4b12b
Author: Robert Muir <rmuir@apache.org>
Date:   Wed Sep 23 17:47:07 2015 -0400

    block process execution with seccomp on linux/amd64
2015-09-24 13:55:26 -04:00
Nik Everett f8fa00185f Better format some stream usage 2015-09-24 13:53:05 -04:00
Nik Everett a4f709c6b8 Fix mistake and revert Stream 2015-09-24 13:52:49 -04:00
Nik Everett 63da3b1a7a Remove methods from code review 2015-09-24 13:43:05 -04:00
javanna db9c2796b3 Query refactoring: last //norelease addressed
Some methods had default implementation while queries were going to be refactored, now that they are all refactored all those methods can be made abstract.
2015-09-24 18:00:36 +02:00
javanna aae7faa88e Query refactoring: minor cleanups before we merge into master
Remove ParseFieldMatcher duplication query in both contexts. QueryParseContext is still contained in QueryShardContext, as parsing still happens in the shards here and there. Most of the norelease comments have been removed simply because the scope of the refactoring has become smaller. Some could only be removed once everything, the whole search request, gets parsed on the coordinating node. We will get there eventually.
2015-09-24 17:53:03 +02:00
Simon Willnauer 78d6d2987f fix groovy tests - we don't pass json anymore so no need to double escape quotes 2015-09-24 16:55:28 +02:00
Colin Goodheart-Smithe 35fc73f094 fix to make parseSource in SearchService work with source overriding template 2015-09-24 15:48:55 +01:00
Colin Goodheart-Smithe bd42d26a76 text fix 2015-09-24 15:19:34 +01:00
Colin Goodheart-Smithe 67237ba269 test fixes 2015-09-24 15:16:16 +01:00
Christoph Büscher 1968d3e0f0 Tests: fixing minor issues in RangeQueryBuilderTests and MatchQueryBuilderTests 2015-09-24 15:43:56 +02:00
Colin Goodheart-Smithe a9c6e4c051 Merge branch 'feature/query-refactoring' into feature/search-request-refactoring
# Conflicts:
#	core/src/main/java/org/elasticsearch/index/query/IndexQueryParserService.java
#	core/src/main/java/org/elasticsearch/index/query/TemplateQueryParser.java
2015-09-24 14:33:35 +01:00
Colin Goodheart-Smithe 851af9e100 fixing up NOCOMMITs and making the IndicesQueryParserService not serialise the QueryBuilder to and from son 2015-09-24 14:20:50 +01:00
javanna 8976934d3b Remove IndexQueryParseService#parse methods used only in tests
SimpleIndexQueryParserTests was the main responsible: deleted lots of duplicated tests, moved the ones that made sense to keep to their corresponding unit tests (note they were ESSingleNode tests before while are now converted to unit tests).

Closes #13750
2015-09-24 13:35:36 +02:00
Christoph Büscher eb8ea63626 Query Refactoring: remove deprecated methods and temporary classes
After all queries now have a `toQuery` method and the parsers all
support `fromXContent` it is possible to remove the following
workarounds and deprecated methods we kept around while doing the
refactoring:

* remove the BaseQueryParser and BaseQueryParserTemp. All parsers
  implement QueryParser directly now
* remove deprecated methods in QueryParseContext that either returned
  a Query or a Filter.
* remove the temporary QueryWrapperQueryBuilder

Relates to #10217
2015-09-24 12:51:19 +02:00
Boaz Leskes d121550a4f Internal: pending operations in the translog prevent shard from being marked as inactive
The IndexingMemoryController checks periodically if there is any indexing activity on the shard. If no activity is sean for 5m (default) the shard is marked as inactive allowing it's indexing buffer quota to given to other active shards.

Sadly the current check is bad as it checks for 0 translog operation. This makes the inactive wait for a flush to happen - which used to take 30m and since #13707 doesn't happen at all (as we rely on the synced flush triggered by inactivity). This commit fixes the check so it will work with any translog size.

Closes #13759
2015-09-24 12:01:07 +02:00
Simon Willnauer 6cbf2de592 Fire off another maybeFlush on finish to ensure we don't miss a pending flush 2015-09-24 09:28:36 +02:00
Colin Goodheart-Smithe 510d1896f7 Revert "correct IndexQueryParserService.parse(QueryBuilder<?>) so that it doesn't convert to JSON and back again"
This reverts commit cc9519eee3.
2015-09-24 00:00:09 +01:00
Colin Goodheart-Smithe cc9519eee3 correct IndexQueryParserService.parse(QueryBuilder<?>) so that it doesn't convert to JSON and back again 2015-09-23 23:58:13 +01:00
Colin Goodheart-Smithe ce7dde08d0 fix SearchSourceBuilder.fromXContent to allow sort to be an object 2015-09-23 23:12:36 +01:00
Nik Everett ffa5b27c75 Use utility 2015-09-23 17:39:43 -04:00
Nik Everett aa06433868 Fix silly mistake 2015-09-23 17:25:37 -04:00
Nik Everett 65041a8121 Entirely remove and ban ImmutableSet
The last usage was ImmutableMap#keySet
2015-09-23 16:26:16 -04:00
Simon Willnauer 1fd8c64f1f [TEST] Add more logging to IndexShardTests#testMaybeFlush() 2015-09-23 22:22:25 +02:00
Nik Everett 04c570461e Remove and ban ImmutableSet#of 2015-09-23 16:14:38 -04:00
Simon Willnauer c93eeb88ca fix inner_hits parsing in SearchService 2015-09-23 22:05:49 +02:00
Colin Goodheart-Smithe 7a209cc600 more test fixes 2015-09-23 20:52:57 +01:00
Simon Willnauer 04864dc7d7 Impl SearchSource#hashCode|equals|toString 2015-09-23 21:50:30 +02:00
Nik Everett b0ab02e35c Remove and ban ImmutableSet#copyOf
It was used heavily in the Guice we've embedded.
2015-09-23 15:37:49 -04:00
Simon Willnauer 95a7b6aa83 Add a late-parsing SearchSoruce wrapper for index warmers 2015-09-23 21:31:00 +02:00
Colin Goodheart-Smithe 2de450ca0b fixes and debugging 2015-09-23 19:57:59 +01:00
Simon Willnauer 0f6e40ede1 Merge pull request #13742 from s1monw/remove_dead_code
Remove `ExpressionScriptCompilationException` and `ExpressionScriptExecutionException`
2015-09-23 20:41:03 +02:00
Colin Goodheart-Smithe 85f4c39b69 more test fixes 2015-09-23 18:58:16 +01:00
Nik Everett 6ecda41485 Remove and ban ImmutableSet#builder 2015-09-23 13:55:34 -04:00
Colin Goodheart-Smithe 63da68e480 test fixes 2015-09-23 18:50:45 +01:00
Jason Tedor 4fe243a5ca Merge pull request #13701 from jasontedor/fix-ping-timeout-settings-inconsistency
Fix ping timeout settings inconsistencies
2015-09-23 13:17:46 -04:00
Colin Goodheart-Smithe 08ae68c195 Merge branch 'feature/query-refactoring' into feature/search-request-refactoring
# Conflicts:
#	core/src/test/java/org/elasticsearch/search/functionscore/DecayFunctionScoreIT.java
#	core/src/test/java/org/elasticsearch/search/functionscore/FunctionScoreFieldValueIT.java
#	core/src/test/java/org/elasticsearch/search/functionscore/FunctionScoreIT.java
#	core/src/test/java/org/elasticsearch/search/rescore/QueryRescorerIT.java
2015-09-23 18:07:30 +01:00
Jason Tedor d8b29f7beb Fix ping timeout settings inconsistencies
This commit fixes ping timeout settings inconsistencies in
ZenDiscovery. In particular, the documentation refers to the ping
timeout setting as discovery.zen.ping_timeout but the code was
ultimately using discovery.zen.ping.timeout if this was set.

This commit also changes all instances of the raw string
“discovery.zen.ping_timeout” to the constant
o.e.d.z.ZenDiscovery.SETTING_PING_TIMEOUT.

Finally, this commit removes the legacy setting
"discovery.zen.initial_ping_timeout".

Closes #6579, #9581, #9908
2015-09-23 12:58:23 -04:00
Colin Goodheart-Smithe 394e551365 removed sysouts 2015-09-23 17:34:28 +01:00
Colin Goodheart-Smithe 52d9664993 fix to sort parsing in SearchService 2015-09-23 17:33:05 +01:00
Colin Goodheart-Smithe 585ed07c5b unit test fixes 2015-09-23 17:26:18 +01:00
Christoph Büscher dbb01f5b43 Query Refactoring: Move MoreLikeThisQueryBuilder validation to constructor
The current MoreLikeThisQueryBuilder validation checks for existence of at
least one `like` text or item. This is hard to check in setters, so this PR
tries to change the construction of the query so that we can do these checks
already at construction time.

Changing to using arrays for fieldnames, likeTexts, likeItems, unlikeTexts
and unlikeItems. `likeTexts` and/or `likeItems` need to be specified at
construction time to validate we have at least one item there.

Relates to #10217
2015-09-23 18:20:46 +02:00
Colin Goodheart-Smithe 2e3cc50a0f removed sysout 2015-09-23 16:57:25 +01:00
Colin Goodheart-Smithe d7429a6c63 Search service can now fully populate SearchContext from SearchSourceBuilder 2015-09-23 16:40:58 +01:00
Nik Everett 13720eb583 Merge pull request #13724 from nik9000/immutable_map_entry_set_be_gone
Remove and ban ImmutableMap#entrySet
2015-09-23 11:10:03 -04:00
Nik Everett 52f3c89c3b Remove and ban ImmutableMap#entrySet
Banning `ImmutableSet` outright is too much to do all at once - this starts
the process by banning `ImmutableMap#entrySet` - one of the more common ways
that `ImmutableSet`s come up. It then starts to remove calls to
`ImmutableMap#entrySet` by changing declarations from `ImmutableMap` to `Map`.

Unfortunately this process is like pulling on a long, windy string and one
declaration change requires another which requires 5 more which in turn
require another few. So this change is rather large.

As such, to keep the changes manageable they only remove `ImmutableMap` from
the signatures that are needed for `entrySet` and make little effort to stop
using `ImmutableMap` internally. Removing the usages of `ImmutableMap`
complicates immutability guarantees and will be done separately.
2015-09-23 11:07:28 -04:00
jaymode 5b8b15e729 expose all addresses that the transports are bound to
In #12942, the NettyTransport and NettyHttpServerTransport were updated to allow for binding
to multiple addresses. However, the BoundTransportAddress holder only exposed the first address
that the transport was bound to and this object is used to populate the values returned to the user
via our APIs.

This change exposes all of the bound addresses in the BoundTransportAddress holder, which allows
for an accurate representation of all interfaces that elasticsearch is bound to and listening on.
2015-09-23 11:06:35 -04:00
Colin Goodheart-Smithe a53cf896dc Parsing of rescuer and sort ByteReferences.
Not the neatest implementation in the world. Maybe we should consider changing the builders so it is a single builder for sort and a single builder for rescore instead of a list of builders for each?
2015-09-23 15:43:35 +01:00
Jason Tedor b1965267ec Fix broken test in BootstrapCliParserTests 2015-09-23 10:37:55 -04:00
Jason Tedor 8d1d8f9c46 Merge pull request #13737 from jasontedor/cli-parameter-order-error-message
More helpful error message on parameter order
2015-09-23 10:14:13 -04:00
Jason Tedor 9e7c56b430 More helpful error message on parameter order
This commit addresses a confusing error message that arises when a
property parameter (e.g. -D) is after a double-dash parameter. The
current error message reports to the user that the parameter does not
start with “--". Adding the second dash as the error message suggests
causes the parameter to be silently ignored. This is confusing for the
user. With this commit, the user is now informed that the parameter
order is violated.

Relates e27ede48ce
2015-09-23 10:13:40 -04:00
Nicholas Knize 8fe9a11943 Fix GeoPointFieldMapper to index geohash at correct precision(s). Add test coverage. 2015-09-23 09:07:52 -05:00
Colin Goodheart-Smithe 083f28a704 remove index from QueryParseContext Constructor 2015-09-23 15:07:33 +01:00
Simon Willnauer a63a30bcc4 Remove `ExpressionScriptCompilationException` and `ExpressionScriptExecutionException`
These exceptions are useless and unused, since we are on a major verison we should remove
them. This commit also makes it easier to remove excepitons in the future.
2015-09-23 15:09:30 +02:00
Simon Willnauer 67a911ff24 [TEST] force REQUEST durabilty otherwise test will fail 2015-09-23 14:10:40 +02:00
Simon Willnauer c32b9c3846 Add back presumably redundant shouldFlush() check.
The check prevents a race condition since we can't use real locks here.
Relates to #13707
2015-09-23 13:57:12 +02:00
Boaz Leskes d62f864317 Reduced the number of ClusterStateUpdateTask variants
In the past ClusterStateUpdateTask was an interface and we had various derived marker interfaces to control behavior. Since then we moved ClusterStateUpdateTask to be an abstract class but we kept the old hierarchy of implementations. All of those (but the AckedClusterStateUpdateTask) can be folded into ClusterStateUpdateTask, adding correct default behavior.

Closes #13735
2015-09-23 13:43:20 +02:00
Robert Muir d6c1880f08 Merge pull request #13726 from rmuir/lang-expression
Factor expressions scripts out to lang-expression plugin
2015-09-23 07:32:15 -04:00
Clinton Gormley e27ede48ce Added a clarifying note about argument order in the bin/elasticsearch start script 2015-09-23 13:17:57 +02:00
Simon Willnauer 75e816400c Remove TranslogService and fold it into synchronous IndexShard API
This commit moves the size and ops based flush into a synchronous API into
IndexShard and removes the time-based flush alltogether since it' basically
covered by the inactive async flush API we have today. The functionality doesn't
need to be covered by scheduled task and async APIs while we can actually make all
the decisions in a sync manner which is way easier to control and to test.

Closes #13707
2015-09-23 12:39:06 +02:00
Simon Willnauer 6c335f4a47 Parse source, extra-source and template-source on the coordinating node
This commit removes all the opaque bytes for extra_source and template_source.
Instead source and extra_source etc. are represented as SearchSourceBuilder which can
in-place be modified and is updated with the content of the request parameters.
Template Source is parsed and evaluated which in-turn replaces the actual source.
2015-09-23 12:24:07 +02:00
Colin Goodheart-Smithe ac8c1722ac fix compile errors 2015-09-23 11:07:20 +01:00
Colin Goodheart-Smithe b98f7cf023 updates to fix some of the NOCOMMITs 2015-09-23 10:44:24 +01:00
Colin Goodheart-Smithe ab01ec5b28 SearchRequest.source() now returns a SearchSourceBuilder.
Lots of NOCOMMITS are in the code as lots of compile errors have been temporarily commented out
2015-09-23 10:44:23 +01:00
Colin Goodheart-Smithe 41e63505b9 muted failing test 2015-09-23 10:44:23 +01:00
Colin Goodheart-Smithe aa3d29dfbc small parsing fix for fields 2015-09-23 10:44:23 +01:00
Colin Goodheart-Smithe b4dd6a5429 fixes to tests 2015-09-23 10:44:23 +01:00
Colin Goodheart-Smithe 3cb3514474 clean up for methods in SearchRequestBuilder so it works with SearchSourceBuilder 2015-09-23 10:44:23 +01:00
Colin Goodheart-Smithe e1759b1a60 cleanup codebase to work with SearchSourceBuilder 2015-09-23 10:44:22 +01:00
Colin Goodheart-Smithe 9116c1c19f Renamed SearchSourceBuilder to OldSearchSourceBuilder and NewSearchSourceBuilder to SearchSourceBuilder 2015-09-23 10:44:22 +01:00
Colin Goodheart-Smithe 3c8c6c0250 Completed serialisation to/from son and transport protocol and added a unit test 2015-09-23 10:44:22 +01:00
Colin Goodheart-Smithe eed6ab7b82 various fixes after a review 2015-09-23 10:44:22 +01:00
Colin Goodheart-Smithe e73052bce2 cleanup of commented out code 2015-09-23 10:44:22 +01:00
Colin Goodheart-Smithe 5623dd2950 implemented hashCode, equals and fromXContent in NewSearchSourceBuidler 2015-09-23 10:44:22 +01:00
Colin Goodheart-Smithe a96f14ecc6 new SearchSourceBuilder to use as the search request 2015-09-23 10:44:22 +01:00
javanna 7eedd84dc3 Query refactoring: refactor query_string query and score functions
Refactor the function_score query so it can be parsed on the coordinating node, split parse into fromXContent and toQuery, make FunctionScoreQueryBuilder Writeable.

Closes #13653
2015-09-23 11:32:54 +02:00
javanna 6350470ee3 Remove index member from QueryParseContext
Given that we are moving to parsing queries on the coordinating node, the index name is not relevant anymore in QueryParseContext, as the parsing phase cannot be related to any specific index. On the contrary, the QueryShardContext is the one that holds mappings etc. and the index name too, as the lucene query creation happens on the data node and can still be related with the index that it happens against.

Changes are mainly around tests that were expecting the index name, moved to using QueryShardException in some of them, removed the index name elsewhere.

Closes #13631
2015-09-23 10:30:53 +02:00
Michael McCandless 4fb6386df3 Merge pull request #13718 from mikemccand/catch_throwable
LoggingRunnable.run should catch and log all errors, not just Exception
2015-09-23 04:24:27 -04:00
Ryan Ernst cfb1e6c6c2 Refactor file script tests to be real unit tests 2015-09-22 23:39:22 -07:00
Ryan Ernst 05957cc4f3 rewrite custom scriptcontext tests to be unit tests 2015-09-22 21:16:10 -07:00
Robert Muir b65a631d9b i am fucking done taking out your trash: have it back, clean it up yourself. just let me secure the system. 2015-09-22 23:50:28 -04:00
Robert Muir 689af1a6d6 Factor expressions scripts out to lang-expression plugin 2015-09-22 20:33:47 -04:00
Nik Everett e284210652 [core] Forbid ForwardingSet
Removes CopyOnWriteHashSet, our only usage of ForwardingSet. We weren't
using it.

Related to #13224
2015-09-22 12:31:08 -04:00
Michael McCandless de8eadab93 catch Throwable instead of Exception in LoggingRunnable.run 2015-09-22 11:36:16 -04:00
Chris Earle 6d3202b6b5 Remove unnecessary suppression 2015-09-22 10:41:50 -04:00
Chris Earle 764051b4e3 Moving system property setting to before it can be used 2015-09-22 10:41:50 -04:00
Christoph Büscher 5ebb074e57 Fixing warnings and errors in javadoc 2015-09-22 13:59:34 +02:00
Christoph Büscher 1aae68d2e8 Merge branch 'master' into feature/query-refactoring
Conflicts:
	core/src/main/java/org/elasticsearch/index/query/CommonTermsQueryBuilder.java
	core/src/main/java/org/elasticsearch/index/query/GeoPolygonQueryBuilder.java
	core/src/main/java/org/elasticsearch/index/query/MatchQueryBuilder.java
	core/src/main/java/org/elasticsearch/index/query/QueryParseContext.java
	core/src/main/java/org/elasticsearch/index/query/QueryParser.java
2015-09-22 12:43:55 +02:00
Christoph Büscher 7d887a1e05 Tests: fix failing GeoDistanceRangeQueryTest 2015-09-22 12:13:53 +02:00
Britta Weber 997ea08e7b remove tests. they are fragile, hard to debug and add no value
closes #13542
closes #13343
closes #13316
2015-09-22 11:42:24 +02:00