Commit Graph

5084 Commits

Author SHA1 Message Date
Ryan Ernst ef1e1acf3d Merge pull request #17864 from rjernst/dynamic_lookup
Mappings: Fix dynamic check to properly handle parents
2016-04-19 14:25:49 -07:00
Nik Everett 994dbf7578 Short the serialization of the empty TaskId
We plan to change every request so that it can support a parentTaskId.
This shrinks EMPTY_TASK_ID, which will be on every request once that change
is made, from 31 bytes to 9 bytes to 1 byte.
2016-04-19 17:21:11 -04:00
Nik Everett 7d94cc99a7 Remove more PROTOTYPEs from aggregations
Relates to #17085
2016-04-19 15:46:46 -04:00
Nik Everett cd982ade99 [test] Fix random bounds
0 is invalid so we don't generate it any more.
2016-04-19 15:44:45 -04:00
Michael Stockerl addf3bb52d #14944 Remove obsolete hasResponseFromRequest method 2016-04-19 20:23:27 +02:00
Ryan Ernst d68318fb6c Mappings: Fix dynamic check to properly handle parents
This change fixes the lookup during document parsing of whether an
object field is dynamic to handle looking up through parent object
mappers, and also handle when a parent object mapper was created during
document parsing.

closes #17854
2016-04-19 10:56:55 -07:00
Lee Hinman b8899cdb78 Merge remote-tracking branch 'dakrone/allow-bad-json' 2016-04-19 10:02:53 -06:00
Nik Everett c982216dbe Remove PROTOTYPEs from Ranges
Relates to #17085
2016-04-19 11:38:16 -04:00
Nik Everett 133cec602c Migrate (read|write)Query to (read|write)NamedWriteable
Now there aren't any more specialized methods to read or write
NamedWriteables! Now StreamInput and StreamOutput don't need to know
about large chunks of the application!
2016-04-19 11:37:24 -04:00
Nik Everett 339d927ee4 Migrate more functions to (read|write)NamedWriteable
ScoreFunction and Suggestion.
Relates #17682.
2016-04-19 11:35:53 -04:00
Martijn van Groningen ba08313417 settings: Removed `action.get.realtime` setting
Closes #12543
2016-04-19 17:14:23 +02:00
Lee Hinman a1e8fb794c Allow JSON with unquoted field names by enabling system property
In Elasticsearch 5.0.0, by default unquoted field names in JSON will be
rejected. This can cause issues, however, for documents that were
already indexed with unquoted field names. To alleviate this, a system
property has been added that can be enabled so migration can occur.

This system property will be removed in Elasticsearch 6.0.0

Resolves #17674
2016-04-19 09:14:13 -06:00
Nik Everett 4169b00441 Remove (read|write)PhraseSuggestionSmoothingModel 2016-04-19 10:25:50 -04:00
Nik Everett cd75c3da2e Remove (read|write)TaskStatus 2016-04-19 10:25:50 -04:00
Nik Everett 52f7c20344 Remove (read|write)SortBuilder 2016-04-19 10:25:50 -04:00
Nik Everett 38721ecf7b Remove writeAllocationCommand and writeValueFormat
Replace with writeNamedWriteable. s/write/read/g
2016-04-19 10:25:50 -04:00
Nik Everett c7c120c781 Remove PROTO from InnerHits
Relates to #17085
2016-04-19 10:17:49 -04:00
Nik Everett edf1c82007 Clean up serialization on some stats
Removes readFrom which is no longer required/actively discouraged and
replaces some instances of `Streamable` with `Writeable`.

Relates to #17085
2016-04-19 10:07:51 -04:00
Nik Everett 860559e543 Remove PROTOTYPE from ExtendedBounds
and make it implement Writeable because it is Writeable.

Relates to #17085
2016-04-19 09:58:37 -04:00
Nik Everett 65f6f6bc8d Normalize registration for SignificanceHeuristics
When I pulled on the thread that is "Remove PROTOTYPEs from
SignificanceHeuristics" I ended up removing SignificanceHeuristicStreams
and replacing it with readNamedWriteable. That seems like a lot at once
but it made sense at the time. And it is what we want in the end, I think.

Anyway, this also converts registration of SignificanceHeuristics to
use ParseFieldRegistry to make them consistent with Queries, Aggregations
and lots of other stuff.

Adds a new and wonderous hack to support serialization checking of
NamedWriteables registered by plugins!

Related to #17085
2016-04-19 09:47:37 -04:00
Nik Everett d62376ce33 Remove PROTOTYPE from KeyedFilter
Relates to #17085
2016-04-19 09:30:45 -04:00
Nik Everett c8af7edb24 Remove PROTOTYPE from AggregatorFactories
Relates to #17085
2016-04-19 09:29:06 -04:00
Daniel Mitterdorfer 0db3eaf7d7 Add additional assertions to IngestClientIT 2016-04-19 15:25:34 +02:00
Boaz Leskes 7cd128b372 Extract non-transport primary logic from TransportReplicationAction #16492
Extracts all the replication logic that is done on the Primary to a separated class called ReplicationOperation. The goal
here is to make unit testing of this logic easier and in the future allow setting up tests that work directly on IndexShards
without the need for networking.

Closes #16492
2016-04-19 15:45:59 +03:00
Nik Everett 7a2b923ad1 Remove deprecated registration methods
Removes deprecated registration methods from SearchModule and
NamedWriteableRegistry and removes the "shims" used to migrate
aggregations to the new registration methods.

Relates to #17085
2016-04-19 08:36:28 -04:00
Christoph Büscher bbe03c92c2 FiltersAggregatorBuilder: Don't create new context for inner parsing
We don't have to create new parse context for inner parsing.
2016-04-19 14:19:11 +02:00
Martijn van Groningen 1a55c073e8 added comment, why we fail here. 2016-04-19 11:32:00 +02:00
Martijn van Groningen 40c22fc654 percolator: removed .percolator type instead a field of type `percolator` should be configured before indexing percolator queries
* Added an extra `field` parameter to the `percolator` query to indicate what percolator field should be used. This must be an existing field in the mapping of type `percolator`.
* The `.percolator` type is now forbidden. (just like any type that starts with a `.`)

This only applies for new indices created on 5.0 and later. Indices created on previous versions the .percolator type is still allowed to exist.
The new `percolator` field type isn't active in such indices and the `PercolatorQueryCache` knows how to load queries from these legacy indices.
The `PercolatorQueryBuilder` will not enforce that the `field` parameter is of type `percolator`.
2016-04-19 11:20:31 +02:00
Jason Tedor ace83d9d2a Refactor UUID-generating methods out of Strings
This commit refactors the UUID-generating methods out of Strings into
their own class. The primary motive for this refactoring is to avoid a
chain of class initializers from loading this class earlier than
necessary. This was discovered when it was noticed that starting
Elasticsearch without any active network interfaces leads to some
logging statements being executed before logging had been
initailized. Thus:
 - these UUID methods have no place being on Strings
 - removing them reduces spooky action-at-distance loading of this class
 - removed the troublesome, logging statements from MacAddressProvider,
   logging using statically-initialized instances of ESLogger are prone
   to this problem

Relates #17837
2016-04-18 21:43:48 -04:00
Nik Everett 6941966b16 Remove PROTOs from TransportAddresses
We have this TransportAddressSerializers that works similarly to
NamedWriteables except it uses shorts instead of streams. I don't know
enough to propose removing it in favor of NamedWriteables to I just ported
it to using Writeable.Reader and left it alone.

Relates to #17085
2016-04-18 18:58:56 -04:00
Ryan Ernst 523b071836 Internal: Remove XContentBuilderString
This was previously used by xcontentbuilder to support camelCase.
However, it is no longer used, and can be replaced with just String.
2016-04-18 14:32:18 -07:00
Ryan Ernst 8ce71f8f25 Merge pull request #17774 from rjernst/camelcase1
Rest: Remove 'case' parameter from rest apis
2016-04-18 14:27:09 -07:00
Ryan Ernst 2739ee6c8f Merge branch 'master' into dots3 2016-04-18 14:24:37 -07:00
Ryan Ernst fbe1f50b18 Add check that no dynamic update was done with existing mappings and
dots
2016-04-18 14:24:11 -07:00
Nik Everett 23dc2d18a2 Fix javadoc for new methods 2016-04-18 16:21:50 -04:00
Nik Everett ff9b28d806 Deprecate remaining readXYZ|writeXYZ methods 2016-04-18 16:19:45 -04:00
Nik Everett 98fa71868c Replace (read|write)Rescorer with (read|write)NamedWriteable 2016-04-18 16:19:45 -04:00
Nik Everett d1722c9908 Replace (read|write)Shape with (read|write)NamedWriteable 2016-04-18 16:19:45 -04:00
Nik Everett d22603831d Replace (read|write)PipelineAggregatorBuilder with (read|write)NamedWriteable 2016-04-18 16:19:45 -04:00
Nik Everett 4ba8bce3fd Replace (read|write)AggregatorBuilder with (read|write)NamedWriteable 2016-04-18 16:19:44 -04:00
Nik Everett 70d55b36e1 Replace writeOptionalQuery with writeOptionalNamedWriteable 2016-04-18 16:19:44 -04:00
Nik Everett 8cffe0fc28 Remove readOptionalQuery
Replace it with readOptionalNamedWriteable
2016-04-18 16:19:44 -04:00
Nik Everett 68b4371bd9 Make readNamedWriteable and writeNamedWriteable public
Now anyone can read or write whatever, whenever.

Closes #17682
2016-04-18 16:19:44 -04:00
Nik Everett ed7b759a45 Cut max, min, stats, and extended stats aggregations over to registerAggregation
and remove their PROTOTYPEs.

Relates to #17085
2016-04-18 11:11:28 -04:00
Nik Everett f6d141a29c Cut percentiles and percentile_ranks to registerAggregation
and remove their PROTOTYPEs.

Relates to #17085
2016-04-18 11:05:39 -04:00
Nik Everett c5bad1d93f Cut remaining pipeline aggregations registerPipelineAggregation
Relates to #17085
2016-04-18 10:56:40 -04:00
Christoph Büscher 36622ecb59 Merge pull request #17822: Use try-with-resource when creating new parser instances where possible
We should wrap newly created XContent parser in a try-with-resources block so it gets properly closed after it has been used.
2016-04-18 16:38:56 +02:00
Christoph Büscher e06e122f9f Wrap xcontent parser creation in try-with-resource statement where possible 2016-04-18 16:13:56 +02:00
Nik Everett 08d3bf937d Cut moving_avg aggregation to registerPipelineAggregation
and remove its PROTOTYPE.

Relates to #17085
2016-04-18 09:37:07 -04:00
Nik Everett b8003de409 Cut bucket_script and bucket_selector to registerPipelineAggregation
and remove their PROTOTYPEs.

Relates to #17085
2016-04-18 09:26:04 -04:00
Christoph Büscher cdb36a2b0c Merge pull request #17417
Clean up QueryParseContext and don't hold it inside QueryRewrite/ShardContext
2016-04-18 15:13:53 +02:00
Nik Everett a9e85182f1 Cut serial_diff and cumulative_sum to registerPipelineAggregation
and remove their PROTOTYPEs.

Relates to #17085
2016-04-18 08:44:49 -04:00
Nik Everett e9fa53b87f Cut global, missing, cardinality, and value_count to registerAggregation
and remove their PROTOTYPEs.

Related to #17085
2016-04-18 08:32:24 -04:00
Christoph Büscher e7cbc55592 Cleaning up query shard context creation in AbstractQueryTestCase 2016-04-18 14:27:50 +02:00
Nik Everett 070b78517e Cut stats_bucket and extended_stats_bucket to registerPipelineAggregation
and remove their PROTOTYPE.

Relates to #17085
2016-04-18 08:19:08 -04:00
Jim Ferenczi 6e4273ae0b Merge pull request #17818 from jimferenczi/search_slow_log
Add missing index name to search slow log.
2016-04-18 12:40:53 +02:00
Danilo Vaz 2e2d8c1442 Updated copyright years to include 2016 (#17808) 2016-04-18 12:39:23 +02:00
Christoph Büscher 478b5024f2 Wrap parser creation in try-with-resources 2016-04-18 12:30:57 +02:00
Jim Ferenczi 3dc21e780b Add missing index name to search slow log.
This commits adds the index name as part of the logging message.
Closes #17025
2016-04-18 12:13:10 +02:00
Daniel Mitterdorfer b84a192884 Honor invariant Suggest.suggestions != null 2016-04-18 10:18:23 +02:00
Daniel Mitterdorfer b9faa13274 Balance request sizes in NettyHttpRequestSizeLimitIT
This test should demonstrate that a single (larger)
request is processed but on of multiple large concurrent requests
is rejected. This test broke too early under some circumstances in
network mode as the limit is quite low.

With this commit we reduce the size of the individual large
requests but issue more concurrent ones thus increasing stability
of this test.
2016-04-18 09:31:48 +02:00
Jim Ferenczi 4575d79522 Merge pull request #17776 from jimferenczi/simple_query_string_wildcard
Apply the default operator on analyzed wildcard in simple_query_string builder
2016-04-15 22:22:55 +02:00
Jim Ferenczi b4e6b63088 Apply the default operator on analyzed wildcard in simple_query_string builder:
* This is a followup from https://github.com/elastic/elasticsearch/pull/17711 where we now apply the default operator on analyzed wildcard query in query_string builder.
2016-04-15 21:56:50 +02:00
Jim Ferenczi 781c0abdc0 Add MatchNoDocsQuery, a query that matches no documents and prints the reason why in the toString method. 2016-04-15 21:53:29 +02:00
David Pilato 5e1f26c22a Add support for documented byte/size units and for micros as a time unit in _cat API
We advertise in our documentation that byte units are like `kb`, `mb`... But we actually only support the simple notation `k` or `m`.
This commit adds support for the documented form and keeps the non documented options to avoid any breaking change.

It also adds support for `micros`, `nanos` and `d` as a time unit in `_cat` API.

Remove the support for `b` as a SizeValue unit. Actually, for numbers, when using raw numbers without unit, there is no text to add/parse after the number. For example, you don't write `10` as `10b`. We support option like `size=` in `_cat` API which means that we want to display raw data without unit (singles).

Documentation updated accordingly.

Add test for the empty size option.

Fix missing TimeValues options for some cat APIs
2016-04-15 20:55:41 +02:00
Christoph Büscher f7e79f4981 Pass down parse context instead of just parser in completion context suggester. 2016-04-15 20:51:05 +02:00
Nik Everett 65803f8abd Cut significant_terms to registerAggregation
and remove its PROTOTYPE.

Relates to #17085
2016-04-15 14:23:43 -04:00
Nik Everett d223090d7d Cut top_hits aggregation to registerAggregation
and remove its PROTOTYPE.

Relates to #17085
2016-04-15 14:15:12 -04:00
Nik Everett c94302d246 Cut geo aggregations to registerAggregation
and remove their prototypes.

Relates to #17085
2016-04-15 14:01:48 -04:00
Michael McCandless b55368b39d Merge pull request #17778 from mikemccand/imc_registered_settings
Switch to registered Settings for all IndexingMemoryController settings
2016-04-15 13:14:12 -04:00
Christoph Büscher 4e77adf38e Clean up creation of shard context in AbstractQueryTestCase
The queryShardContext we create during setup was sometimes
accessed directly, sometimes by making a copy through
the createShardContext() helper. This should be the default.
Also making sure that strict parsing is switched on via
IndexSettings in the test testup.
2016-04-15 17:47:19 +02:00
Christoph Büscher fbd558382d Clean up QueryParseContext and don't hold it inside QueryRewrite/ShardContext
This change cleans up a few things in QueryParseContext and QueryShardContext
that make it hard to reason about the state of these context objects and are
thus error prone and should be simplified.

Currently the parser that used in QueryParseContext can be set and reset any
time from the outside, which makes reasoning about it hard. This change makes
the parser a mandatory constructor argument removes ability to later set a
different ParseFieldMatcher. If none is provided at construction time, the
one set inside the parser is used. If a ParseFieldMatcher is specified at
construction time, it is implicitely set on the parser that is beeing used.
The ParseFieldMatcher is only kept inside the parser.

Also currently the QueryShardContext historically holds an inner QueryParseContext
(in the super class QueryRewriteContext), that is mainly used to hold the parser
and parseFieldMatcher. For that reason, the parser can also be reset, which leads
to the same problems as above. This change removes the QueryParseContext from
QueryRewriteContext and removes the ability to reset or retrieve it from the
QueryShardContext. Instead, `QueryRewriteContext#newParseContext(parser)` can be
used to create new parse contexts with the given parser from a shard context
when needed.
2016-04-15 17:13:01 +02:00
Nik Everett b5a58ece41 Cut nested and reverse_nested aggregations to registerAggregation
and remove their PROTOTYPES.

Relates to #17085
2016-04-15 10:19:03 -04:00
Adrien Grand eb4ba38032 Add points to SegmentStats. #17775
This way points memory and disk usage will be reported in the stats API.

Closes #16974
2016-04-15 15:58:26 +02:00
Nik Everett 7f6a765a1e Cut the sampler and diversified_sampler aggregations to registerAggregation
and remove their PROTOTYPEs.

Relates to #17085
2016-04-15 09:53:56 -04:00
Mike McCandless a361f5b810 fix test method name 2016-04-15 09:47:08 -04:00
Mike McCandless 529087301a fix IndexingMemoryController to use existing Settings API support to parse % or byte size, and to enforce min/max values; don't try to share string constants for settings in tests 2016-04-15 09:42:29 -04:00
Christoph Büscher 068df5f8aa Merge pull request #17756 from cbuescher/no-pfm-in-parser
Remove ParseFieldMatcher from AbstractXContentParser
2016-04-15 15:21:27 +02:00
Christoph Büscher de036d63d8 Rename context.parseFieldMatcher() to context.getParseFieldMatcher 2016-04-15 15:15:32 +02:00
Christoph Büscher 15c59d07b3 Remove ParseFieldMatcher from AbstractXContentParser
Currently we are able to set a ParseFieldMatcher on XContentParsers,
mainly to conveniently carry it around to be available where the
actual parsing happens. This was just recently introduced together
with ObjectParser so that ObjectParser can make use of deprecation
logging and throwing errors while parsing.

This however is trappy because we create parsers in so many places in
the code and it is easy to forget setting the right ParseFieldMatcher.
Instead we should hold the ParseFieldMatcher only in the parse contexts
(e.g. QueryParseContext).

This PR removes the ParseFieldMatcher from XContentParser. ObjectParser
can still make use of it because we can make the otherwise unbounded
`context` type to extend an interface that makes sure contexts used in
ObjectParser can supply a ParseFieldMatcher. Contexts in ObjectParser
are now no longer optional, but it is sufficient to pass in a small
lambda expression in places where no other context is available.

Relates to #17417
2016-04-15 15:14:46 +02:00
Nik Everett e3c65408ec Cut terms aggregation to registerAggregation
and remove its PROTOTYPE. This is the first aggregation builder that
serializes its targetValueType so ValuesSourceAggregatorBuilder had to
grow support for that.

Relates to #17085
2016-04-15 09:12:29 -04:00
Nik Everett cf80b00507 Cut filters aggregation to registerAggregation
and remove its PROTOTYPE.
2016-04-15 09:04:46 -04:00
Nik Everett 135511134c Fix bad toXContent for derivative aggregation
I busted it in the last commit.
2016-04-15 08:51:22 -04:00
Nik Everett a36b6138d7 Cut avg aggregation to registerAggregation
and remove its PROTOTYPE

Relates to #17085
2016-04-15 08:37:22 -04:00
Nik Everett b10c1f1939 Cut derivative aggregation to registerPipelineAggregation
and remove its PROTOTYPE.
2016-04-15 08:28:18 -04:00
Nik Everett beafae8ea5 Cut range aggregations to registerAggregation
and remove their PROTOTYPES. Does not remove the PROTOTYPEs from their
Range implementations which will have to wait for another commit.
2016-04-15 08:14:05 -04:00
Mike McCandless 36e99c5f8d switch to registered Settings for all IndexingMemoryController settings 2016-04-15 06:10:30 -04:00
Colin Goodheart-Smithe d863cbaa07 [TEST] fix geo_bounding_box tests to work with unmapped fields 2016-04-15 10:10:43 +01:00
Daniel Mitterdorfer 3688629e11 Adjust line-length of transport related classes to coding standard 2016-04-15 10:12:24 +02:00
Ryan Ernst c3f4eb36e3 Merge pull request #17768 from rjernst/dots4
Mappings: Fix array parsing to remove its context when finished parsing
2016-04-15 00:22:55 -07:00
Ryan Ernst 88dd6ba430 Rest: Remove 'case' parameter from rest apis
The current api allows for choosing which "case" response json keys are
written in. This has the options of camelCase or underscore. camelCase
is going to be deprecated from the query apis. However, with the case
api, it is not necessary to deprecate, as users who were using it in 2.x
can transition completely on 2.x before upgrading by simply using
the underscore option.

This change removes the 'case' option from rest apis.

see #8988
2016-04-14 23:07:19 -07:00
Jason Tedor f985cfc95a Add max map count check
This commit adds a bootstrap check on Linux for the max map count (max
virtual memory areas) available to the Elasticsearch process.

Relates #16944
2016-04-14 21:04:03 -04:00
Igor Motov f030796b0b Shard level tasks in Bulk Action lose reference to their parent tasks
During the bulk action a hierachy of tasks is getting created: bulk->bulk[s] (coord node) -> bulk[s] (primary shard node) -> bulk[s][p] and bulk[s][r]. Due to a bug the first bulk[s] task didn't have bulk's task id is set as a parent id.  This commit fixes this bug.
2016-04-14 19:30:07 -04:00
Ryan Ernst 24130e1f30 Merge pull request #17764 from rjernst/parse_doc_without_threadlocal
Internal: Remove threadlocal from document parser
2016-04-14 15:17:45 -07:00
Ryan Ernst 60df3450f4 Mappings: Fix array parsing to remove its context when finished parsing
Handling of the current path when parsing a document is very sensitive.
This fixes a subtle bug in array parsing, where the path that was added
by parsing an array would not be cleared. It also adds a hard state
check at the end of parsing to ensure we ended with a clean path.
2016-04-14 14:45:29 -07:00
Ryan Ernst c6dd17a2c6 Internal: Remove threadlocal from document parser
The doc parser uses a context object to store the state of parsing,
namely the existing mappings, new mappings, and the parsed document.
Currently this uses a threadlocal which is "reset" for each doc parsed.
However, the thread local doesn't actually save anything, since
resetting is constructing new objects. This change removes the thread
local, which also simplifies the mapper service as it now does not need
to be closeable.
2016-04-14 13:10:20 -07:00
Ryan Ernst 125473dc9f Mappings: Support dots in field names when mapping exists
In 2.0 we began restricting fields to not contains dots in their names.
This change adds back part of dots in fieldnames support. Specifically,
it allows indexing documents that contain dots in the field names, when
the correct corresponding mappers exist. For example, if mappings
contain an object field `foo`, and a subfield `bar`, then indexing a
document with `foo.bar` will work.

see #15951
2016-04-14 11:31:45 -07:00
Jason Tedor ea26e86880 Actually restore lost Node#start no-op check
This commit really reverts the inadvertent removal of allowing duplicate
calls to Node#start to be a no-op (but was mistakenly restored to
Node#stop in ddfa3a661510f25c2ce431dfd6fb86ac11eb8888).
2016-04-14 14:26:04 -04:00
Jason Tedor f87c599ff1 Revert "Restore lost Node#start no-op check"
This reverts commit ddfa3a661510f25c2ce431dfd6fb86ac11eb8888.
2016-04-14 14:26:04 -04:00
Nik Everett 3197f7f7d8 Remove PROTOTYPE from filter aggregation
and cut it to registerAggregation

Relates to #17085
2016-04-14 12:37:40 -04:00
Adrien Grand 0c9aca94d4 Disallow fielddata loading on text fields that are not indexed. #17747
If a field is not indexed, we cannot load fielddata for it.
2016-04-14 18:11:11 +02:00
Colin Goodheart-Smithe 90d044309f Merge pull request #17710 from colings86/deprecate/indicesQuery
Deprecate Indices query
2016-04-14 17:09:42 +01:00
Adrien Grand d84c643f58 Use the new points API to index numeric fields. #17746
This makes all numeric fields including `date`, `ip` and `token_count` use
points instead of the inverted index as a lookup structure. This is expected
to perform worse for exact queries, but faster for range queries. It also
requires less storage.

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

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

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

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

Closes #17638
2016-04-14 11:14:02 -04:00
Christoph Büscher c9cb1de6cb Remove parser argument from methods where we already pass in a parse context
When we pass both XContentParser and QueryParseContext to a method this can be trappy because 
we cannot make sure that the parser contained in the context and the parser passed as an argument 
are the same. 
This removes the parser argument from methods where we currently have both the parser and the parse 
context as arguments and instead retrieves the parse from the context inside the method.
2016-04-14 17:09:52 +02:00
Nik Everett 348ad7a42e Label method as @SafeVarargs 2016-04-14 10:45:58 -04:00
Nik Everett eecec97274 Fix funny generics in request size limit test 2016-04-14 10:45:58 -04:00
Nik Everett eb71918878 Add SearchAfter's validation back to the setter
It was part of the serialization but I removed it to convert to
writeGenericValue.
2016-04-14 10:31:35 -04:00
Nik Everett f1ad5254e4 Switch SearchAfterBuilder to writeGenericValue
and remove its PROTOTYPE.

Relates to #17085
2016-04-14 10:31:27 -04:00
Nik Everett 8ad0070cea Remove remaining PROTOTYPEs from org.elasticsearch.search.suggest 2016-04-14 10:30:31 -04:00
Colin Goodheart-Smithe c595322d90 Adds ignore_unmapped option to geo queries
The change adds a new option to the geo_* queries: ignore_unmapped. If this option is set to false, the toQuery method on the QueryBuilder will throw an exception if the field specified in the query is unmapped. If the option is set to true, the toQuery method on the QueryBuilder will return a MatchNoDocsQuery. The default value is false so the queries work how they do today (throwing an exception on unmapped field)
2016-04-14 15:29:07 +01:00
Christoph Büscher bccf8a39c4 Removing aggregations_binary support from AggregatorParsers 2016-04-14 16:22:27 +02:00
Nik Everett 18f8f3f67a Cleanup after removing StreamableReader
Javadoc and unused imports!
2016-04-14 10:22:23 -04:00
Nik Everett b8fa7abf6a Remove StreamableReader
It's use tempted the creation of PROTOTYPEs. The only classes that
legitimately implement a readFrom method are those extending from
Diffable - such behavior is part of cluster state management and
out of scope for the PROTOTYPE cleanup.
2016-04-14 10:22:23 -04:00
Christoph Büscher e15e7f7e6e Remove parser argument from methods where we already pass in a parse context
When we pass down both parser and QueryParseContext to a method, we cannot
make sure that the parser contained in the context and the parser that is
parsed as an argument have the same state. This removes the parser argument
from methods where we currently have both the parser and the parse context
as arguments and instead retrieves the parse from the context inside the
method.
2016-04-14 16:18:05 +02:00
Jason Tedor ed3a71fa2b Fix JvmInfoTests#testUseG1GC to include OpenJDK VMs
Since OpenJDK virtual machines have G1 GC but do not have a java.vm.name
that contains HotSpot, this test fails on OpenJDK. Instead, the
java.vm.name condition should be expanded to include OpenJDK virtual
machines.
2016-04-14 10:09:55 -04:00
Nik Everett 1c5449fe1a Remove PROTOTYPE from scripted_metric aggregation
and cut it to registerAggregation.

Relates to #17085
2016-04-14 10:05:26 -04:00
Yannick Welsch b7a1baa801 Simplify ActionListenerResponseHandler by adding response supplier (#17752) 2016-04-14 15:46:55 +02:00
Adrien Grand b3eef99120 Remove FieldStats.Float. #17749
Since doubles can represent all floats accurately, we can just use
FieldStats.Double instead.
2016-04-14 15:03:35 +02:00
Martijn van Groningen 2928fd6ef3 Cleanup query builder for inner hits construction.
* Inner hits can now only be provided and prepared via setter in the nested, has_child and has_parent query.
* Also made `score_mode` a required constructor parameter.
* Moved has_child's min_child/max_children validation from doToQuery(...) to a setter.
2016-04-14 14:43:21 +02:00
Jason Tedor c9ada75e35 Merge pull request #17740 from jasontedor/g1gc-tests
Pass test JVM arguments to test nodes
2016-04-14 08:08:11 -04:00
Jason Tedor 79d3415210 Help JDK 9 type inference in ShardStateIT.java
The JDK 9 compiler type inference gets confused, so we need to help it
here.
2016-04-14 07:43:41 -04:00
Jason Tedor 4b801f54d1 Add test that JvmInfo correctly determines G1 GC
This commit adds a simple test that JvmInfo is correctly able to
determine whether or not G1 GC is running. As the JvmInfo G1 GC logic is
only applies to HotSpot, the test is constructed to do the same. The
test determines whether or not G1 GC is running by inspecting the test
JVM argument line.
2016-04-14 07:43:40 -04:00
Nik Everett dd3b4a1e50 Add {} to ifs in org.apache.lucene 2016-04-14 07:38:08 -04:00
Daniel Mitterdorfer e87b09e8dd Temporarily disable CircuitBreakerServiceIT.testParentChecking() 2016-04-14 13:07:11 +02:00
Colin Goodheart-Smithe 686aff1545 Adds ignore_unmapped option to nested and P/C queries
The change adds a new option to the `nested`, `has_parent`, `has_children` and `parent_id` queries: `ignore_unmapped`. If this option is set to false, the `toQuery` method on the QueryBuilder will throw an exception if the type/path specified in the query is unmapped. If the option is set to true, the `toQuery` method on the QueryBuilder will return a MatchNoDocsQuery. The default value is `false`so the queries work how they do today (throwing an exception on unmapped paths/types)
2016-04-14 10:34:30 +01:00
Daniel Mitterdorfer c22d93f7cc Increase breaker limit in NettyHttpRequestSizeLimitIT
With the previous breaker limit spurious failures on transport level
can happen in the test. With the new limit we ensure that the breaker
breaks due to a too large HTTP request instead.
2016-04-14 10:12:45 +02:00
Adrien Grand 1c858b57c4 Fix test bug in ZenDiscoveryIT. 2016-04-14 09:52:25 +02:00
Colin Goodheart-Smithe f7ef600644 Aggregations: Adds serialisation of sigma to extended_stats_bucket pipeline aggregation
Previously the sigma variable in the `extended_stats_bucket` pipeline aggregation was not being serialised in `ExtendedStatsBucketPipelineAggregator`. This PR fixes that.

It also corrects the initial value of sumOfSquares to be 0.

Closes #17701
2016-04-14 08:28:56 +01:00
Nik Everett 86a9365c53 Small format changes in script and monitor packages
Just three files - just adding {}s to if and for statements or making
them single line.
2016-04-13 22:02:42 -04:00
Nik Everett 0386d8ec84 Remove PROTOTYPE from ScriptField
Relates to #17085
2016-04-13 21:30:01 -04:00
Jason Tedor 666172284b Refactor BootstrapCheckTests to use expectThrows
This commit modifies all uses of the pattern try/catch/assert in
BootstrapCheckTests to use expectThrows/assert.

Closes #17731
2016-04-13 18:41:14 -04:00
Nik Everett 3d5def0789 Remove remaining PROTOTYPEs from org.elasticsearch.index.query
Relates to #17085
2016-04-13 16:16:28 -04:00
Jason Tedor 11648cbff6 Merge pull request #17728 from jasontedor/heap-size
Add heap size bootstrap check
2016-04-13 15:11:17 -04:00
Jason Tedor 4f5d73bcb7 Add heap size bootstrap check
This commit adds a bootstrap check to ensure that the initial heap size
and max heap size are set equal to each other.
2016-04-13 15:10:31 -04:00
Boaz Leskes a0d1f8889d Rebalancing policy shouldn't prevent hard allocation decisions (#17698)
#14259 added a check to honor rebalancing policies (i.e., rebalance only on green state) when moving shards due to changes in allocation filtering rules. The rebalancing policy is there to make sure that we don't try to even out the number of shards per node when we are still missing shards. However, it should not interfere with explicit user commands (allocation filtering) or things like the disk threshold wanting to move shards because of a node hitting the high water mark.

#14259 was done to address #14057 where people reported that using allocation filtering caused many shards to be moved at once. This is however a none issue - with 1.7 (where the issue was reported) and 2.x, we protect recovery source nodes by limitting the number of concurrent data streams they can open (i.e., we can have many recoveries, but they will be throttled). In 5.0 we came up with a simpler and more understandable approach where we have a hard limit on the number of outgoing recoveries per node (on top of the incoming recoveries we already had).
2016-04-13 20:44:41 +02:00
Igor Motov b01f3b2cd1 Node names cleanup
Fixes two node names contained trailing spaces that was causing cat.tasks test to fail.

Fixes #17718
2016-04-13 12:50:12 -04:00
Sebastian Utz 0b889f1a8f Fix index selection for snapshot restore when non-existent indices are specified (#17715) 2016-04-13 17:25:59 +02:00
Jason Tedor 96456fbd91 Remove remaining uses of JAVA_OPTS
This commit removes the last remaining uses of JAVA_OPTS. Now searching
the codebase for the regex '(?<!ES_)JAVA_OPTS' only shows the uses
warning of its removal and the note about it in the migration docs.
2016-04-13 10:51:53 -04:00
Jim Ferenczi 3c355b66fe Apply the default operator on analyzed wildcard in query_string builder:
* Tokens in the same position are grouped into a SynonymQuery..
 * The default operator is applied on tokens in different positions.
 * The wildcard is applied to the terms in the last position only.
Fixes #2183
2016-04-13 15:41:29 +02:00
Nik Everett edc09a7ac5 Add NORELEASE while we migrate aggregations 2016-04-13 09:31:54 -04:00
Nik Everett e1a3aca08b Remove PROTOTYPE from children aggregation
This required some surgery to get serialization working but should allow
us to do the aggregations one at a time.
2016-04-13 09:31:54 -04:00
Nik Everett a170de5df7 Cut children aggregation to registerAggregation 2016-04-13 09:31:53 -04:00
Nik Everett b8fdb19312 Remove getQueryPrototype from QueryParser
It isn't used any more.
2016-04-13 09:27:19 -04:00
Jason Tedor fc7442739c Output all failing bootstrap checks
This commit modifies the boostrap checks to output all failing checks
instead of early-failing on the first check and then possibly failing
again after the user resolves the first failing check.

Closes #17474
2016-04-13 08:48:20 -04:00
Jason Tedor cfc23a9d67 Move bootstrap checks to node start
This commit moves the execution of the bootstrap checks to after network
services are started. This gives us the flexibility to not merely check
if any of the network settings are set, but instead be smarter about it
and check if the network settings are set in a way that means that the
node will be communicating over an external network (either directly, or
via a proxy). As an bonanza, executing the bootstrap checks in this way
enables us to have the node name in the logs!

Closes #17570
2016-04-13 08:48:10 -04:00
Nik Everett 64f5a4f848 Stop map collisions on FiltersTests
Adds randomUnique to generate unique things and uses it to make unique
keys.

The offending seed was 81AE616FEAD10F17.
2016-04-13 08:35:45 -04:00
Nik Everett cca3154c43 Rename isSourceEmpty to hasSource
And add a test case for {} to reindex.
2016-04-13 08:19:58 -04:00
Colin Goodheart-Smithe b226cc7e7f Deprecate Indices query
This is in favour of just searching the _index field

Closes #12017
2016-04-13 12:35:14 +01:00
Jun Ohtani 048d273408 Cat: cat health supports ts=0 option
If ts=0, cat health disable epoch and timestamp
Be Constant String timestamp and epoch
Move timestamp and epoch to Table
Add rest-api test and test

Closes #10109
2016-04-13 18:08:30 +09:00
Daniel Mitterdorfer 0c7795f53d Merge remote-tracking branch 'danielmitterdorfer/bulk-size-limit'
Closes #17133
2016-04-13 10:43:00 +02:00
Adrien Grand 82849a787a Add back the Version.V_5_0_0 constant. #17688 2016-04-13 10:00:37 +02:00
Daniel Mitterdorfer 117bc68af3 Limit request size on HTTP level
With this commit we limit the size of all in-flight requests on
HTTP level. The size is guarded by the same circuit breaker that
is also used on transport level. Similarly, the size that is used
is HTTP content length.

Relates #16011
2016-04-13 09:58:08 +02:00
Daniel Mitterdorfer 52b2016447 Limit request size on transport level
With this commit we limit the size of all in-flight requests on
transport level. The size is guarded by a circuit breaker and is
based on the content size of each request.

By default we use 100% of available heap meaning that the parent
circuit breaker will limit the maximum available size. This value
can be changed by adjusting the setting

network.breaker.inflight_requests.limit

Relates #16011
2016-04-13 09:54:59 +02:00
Nik Everett ba9b72c297 Reformat DirectCandidateGenerator's equals method
We'd like to have checkstyle complain about if statements without braces
for all non-single-line if statements.
2016-04-12 17:30:43 -04:00
Nik Everett fe4d1297df Make AllocationCommands register in the same way as queries
The cluster reroute API had a copy of NamedWriteableRegistry's behavior
inside it in the form of AllocationCommands#registerFactory and
AllocationCommands#lookupFactorySafe. There isn't a reason to duplicate
that effort. So this replaces all of AllocationCommand#Factory with
query-like registration in NetworkModule. Why NetworkModule? Because
the transport client needs it.
2016-04-12 17:29:11 -04:00
Nik Everett d5d85e4350 Isolate StreamableReader
Makes Writeable not depend on StreamableReader. Keeps the default readFrom
implementation for backwards compatibility during the PROTOTYPE removal
but that'll go when those are gone.

Makes Diffable not extend StreamableReader. Instead Diffable has a readFrom
method. The PROTOTYPE removal will not get to cluster state for a long time
so that method will stay.

Now only a few things implement StreamableReader. They will be addressed
individually and then we'll remove StreamableReader.
2016-04-12 15:43:58 -04:00
Nik Everett 7908759949 Make aggregation registration more like query registration
Creates a class to hold behavior common to these `ParseFieldRegistry`s.

Also renames some weirdly named methods on StreamInput.
2016-04-12 14:50:44 -04:00
Christoph Büscher fae0666226 Remove norelease comments in test classes
This doesn't seem to block release, and the comments should
rather be tasks that be left in the code base.
2016-04-12 19:48:46 +02:00
Boaz Leskes 5af6982338 TransportNodesListGatewayStartedShards should fall back to disk based index metadata if not found in cluster state (#17663)
When an index is recovered from disk it's metadata is imported first and the master reaches out to the nodes looking for shards of that index. Sometimes those requests reach other nodes before the cluster state is processed by them. At the moment, that situation disables the checking of the store, which requires the meta data (indices with custom path need to know where the data is). When corruption hits this means we may assign a shard to node with corrupted store, which will be caught later on but causes confusion. Instead we can try loading the meta data from disk in those cases.

Relates to #17630
2016-04-12 18:41:00 +02:00
Christoph Büscher 9567f154e6 Removing unused parse method from SortBuilder 2016-04-12 18:00:55 +02:00
Nik Everett 2c487110b2 Remove PROTOTYPE from SearchSourceBuilder
Relates to #17085
2016-04-12 11:57:57 -04:00
Adrien Grand 3bf6f4076c Do not set analyzers on numeric fields.
When it comes to query parsing, either a field is tokenized and it would go
through analysis with its search_analyzer. Or it is not tokenized and the
raw string should be passed to termQuery(). Since numeric fields are not
tokenized and also declare a search analyzer, values would currently go through
analysis twice...
2016-04-12 17:47:29 +02:00
Colin Goodheart-Smithe f5bade1a0d SimpleQueryParser should call MappedFieldType.termQuery when appropriate. #17678
This will allow to use it on virtual fields like `_index` or `_id` which do not
exist in the index.
2016-04-12 17:47:18 +02:00
Nik Everett 2ed7769ddc Make registerScoreFunction look like registerQuery
The order of the first two arguments was different on the two register
functions. This makes them consistent.
2016-04-12 11:35:29 -04:00
Nik Everett eb338f46f7 Remove PROTOTYPE from QueryBuilders
Relates to #17085
2016-04-12 08:18:07 -04:00
Martijn van Groningen 6776586725 percolator: small cleanup by using MemoryIndex#fromDocument(...) helper
Now also `position_increment_gap` is taken into account.

Closes #9386
2016-04-12 10:50:42 +02:00
Adrien Grand 226644ea2c Do not assume term queries use the inverted index. #17532
We have a couple places in the code base that assume that search is always done
on the inverted index. However with the new points API in Lucene 6, this is not
true anymore. This commit makes MappedFieldType.indexedValueForSearch protected
and fixes call sites to keep working for field types that use the inverted
index and either work differently ar throw an exception otherwise. For instance,
it will still be possible to run cross_fields multi match queries on numeric
fields, but the score contributions will not be blended as well as before, and
significant terms aggregations on long terms will not be possible anymore since
points do not record document frequencies.
2016-04-12 09:47:20 +02:00
Adrien Grand 013acf9179 Remove MappedFieldType.value. #17557
This commit removes `MappedFieldType.value` and simplifies
`MappedFieldType.valueforSearch`. `valueforSearch` was used to post-process
values that come for stored fields (eg. to convert a long back to a string
representation of a date in the case of a date field) and also values that
are extracted from the source but only in the case of GET calls: it would
not be called when performing source filtering on search requests.

`valueforSearch` is now only called for stored fields, since values that are
extracted from the source should already be formatted as expected.
2016-04-12 09:12:56 +02:00
Adrien Grand 7ad804fa52 Remove MappedFieldType.isSortable(). #17598
It is not really needed.
2016-04-12 08:57:02 +02:00
Adrien Grand a14db8e17e Remove MappedFieldType.useTermQueryWithQueryString() and isNumeric(). #17599
In both cases, what elasticsearch is really interested in is whether the field
is an analyzed string field. So it can just check `tokenized()` instead.
2016-04-12 08:45:28 +02:00
Nicholas Knize 3460fdb3a4 removing remaining lucene.experimental javadoc tag 2016-04-11 21:39:59 -05:00
Nicholas Knize 7112827dd2 remove unknown javadoc tag 2016-04-11 20:52:12 -05:00
Adrien Grand 496c7fbd84 Upgrade Lucene 6 Release
* upgrades numerics to new Point format
* updates geo api changes
  * adds GeoPointDistanceRangeQuery as XGeoPointDistanceRangeQuery
  * cuts over to ES GeoHashUtils
2016-04-11 16:50:04 -05:00
Ryan Ernst f7a63a5e65 Plugin cli: Add verbose output with zip url when installing plugin
closes #17529
2016-04-11 13:33:06 -07:00
Adrien Grand 0eb1a816c8 Allow the query cache to be disabled. #16268
This replaces the internal `index.queries.cache.type` setting with
a new `index.queries.cache.enabled` setting, which is documented.

Closes #15802
2016-04-11 18:06:16 +02:00
Adrien Grand 13c1efd4d1 Propagate DocValueFormat to all terms aggs. #17646
TL;DR This commit should not have any impact on terms aggs, it will just make
supporting ipv6 easier.

Currently only the numeric terms aggs propagate the DocValueFormat instance since
we use numerics to represent also dates or ip addresses. Since string terms aggs
are only used for text/keyword/string fields, they do not use the format and just
call toUt8String(). However when we support ipv6, ip addresses as well will be
encoded in sorted doc values (just like strings) so we will need to use the
DocValueFormat to format the keys.
2016-04-11 16:33:19 +02:00
Alexander Reelsen 9fc4ce294a Tests: Fixing SimulateProcessorResultTests due to recent ingest attachment changes 2016-04-11 15:52:22 +02:00
Alexander Reelsen da19ddf3e6 Ingest Attachment: Allow to prevent base64 conversions by using raw bytes (#16601)
CBOR is natively supported in Elasticsearch and allows for byte arrays.
This means, that by using CBOR the user can prevent base64 conversions
for the data being sent back and forth.

This PR adds support to extract data from a byte array in addition to
a string. This also required to add a ByteArrayValueSource class.
2016-04-11 14:14:56 +02:00
Jim Ferenczi 2713a08fb3 Merge pull request #17613 from jimferenczi/all_field
Simplify AllEntries, AllField and AllFieldMapper
2016-04-11 12:13:48 +02:00
Daniel Mitterdorfer 0cdea41bf5 Turn RestChannel into an interface
In #17133 we introduce request size limit handling and need a custom
channel implementation. In order to ensure we delegate all methods
it is better to have this channel implement an interface instead of
an abstract base class (so changes on the interface turn into
compile errors).

Relates #17133
2016-04-11 11:06:39 +02:00
David Pilato 1e346d1ac1 Merge branch 'fix/17625-close-ingest-factory' 2016-04-11 10:00:19 +02:00
David Pilato cc4fb61a38 Simplify the test 2016-04-11 09:59:13 +02:00
Nik Everett 525ce40d1c Give SearchContext a toString
and move the string capturing to capture time.
2016-04-10 20:55:31 -04:00
Nik Everett ac94e5f287 Provide more information about open contexts
Sometimes we get a test failure caused by search contexts left open.
The tests include a stack trace of the call that opened the context
but nothing else about the context. This adds more information about
the context that has been left open like what query it was running,
what shard it targeted, and whether or not it was a scroll.

Relates to #17582
2016-04-10 20:55:31 -04:00
David Pilato 24f48b86b5 Update after review and add a Test 2016-04-09 13:14:25 +02:00
Jason Tedor 4ff8f5c16c Revert "Exploit DiscoveryNode immutability..."
This reverts commit e76038e076.
2016-04-08 19:29:55 -04:00
Adrien Grand 4adc31fe11 Use `mmapfs` by default.
I case any problem was discovered, you can still enable the legacy `default`
directory instead. But the plan is to get rid of it in 6.0.

Closes #16983
2016-04-08 20:23:27 +02:00
David Pilato 09fc9485c6 Ingest does not close its factories
When you implement an ingest factory which implements `Closeable`:

```java
public static final class Factory extends AbstractProcessorFactory<MyProcessor> implements Closeable {
    @Override
    public void close() throws IOException {
        logger.debug("closing my processor factory");
    }
}
```

The `close()` method is never called which could lead to some leak threads when we close a node.

The `ProcessorsRegistry#close()` method exists though and seems to do the right job:

```java
@Override
public void close() throws IOException {
    List<Closeable> closeables = new ArrayList<>();
    for (Processor.Factory factory : processorFactories.values()) {
        if (factory instanceof Closeable) {
            closeables.add((Closeable) factory);
        }
    }
    IOUtils.close(closeables);
}
```

But apparently this method is never called in `Node#stop()`.

Closes #17625.
2016-04-08 18:19:57 +02:00
Adrien Grand 42526ac28e Remove Settings.settingsBuilder.
We have both `Settings.settingsBuilder` and `Settings.builder` that do exactly
the same thing, so we should keep only one. I kept `Settings.builder` since it
has my preference but also it is the one that we use in examples of the Java API.
2016-04-08 18:10:02 +02:00
Nik Everett df8a971966 Assert names of read writeables
Adds an assertion that when reading a NamedWriteable it has the same name
you read. It'd be *super* weird if it didn't.
2016-04-08 08:30:22 -04:00
Nik Everett d349de71aa Remove registerQueryParser
We've fully cut over to registerQuery!
2016-04-08 08:17:25 -04:00
Jim Ferenczi c565718ae6 Simplify AllEntries, AllField and AllFieldMapper:
* Create one AllField field per field eligible for _all.
  * Add a positionIncrementGap (with a size of 100, not configurable) between
  each entry in order to distinguish fields when doing phrase query on _all.
2016-04-08 10:58:58 +02:00
Adrien Grand 0d8e399781 Fix `MapperService.unmappedType("string")` to not raise an error.
A deprecation log will be emitted if you do. This should fix the kibana build.
2016-04-08 10:08:36 +02:00
Nik Everett e0cde29a68 Cut over remaining queries to registerQuery 2016-04-07 18:48:10 -04:00
Chris Earle d97d5ebb8b Remove hostname from NetworkAddress.format
This removes the inconsistent output of IP addresses. The format was parsing-unfriendly and it makes it hard
to reason about API responses, such as to _nodes.

With this change in place, it will never print the hostname as part of the default format, which has the
added benefit that it can be used consistently for URIs, which was not the case when the hostname might
appear at the front with "hostname/ip:port".
2016-04-07 17:27:59 -04:00
Ali Beyad 763a659830 Fixes reading of CORS pre-flight headers and methods
CORS headers and methods config parameters must be read as arrays.  This
commit fixes the issue.  It affects http.cors.allow-methods and
http.cors.allow-headers.

Fixes #17483
2016-04-07 15:32:47 -04:00
Lee Hinman 82c2b1e48e Merge remote-tracking branch 'dakrone/allocation-explain-show-delay' 2016-04-07 12:56:28 -06:00
Lee Hinman 199c7256c8 Make passed in settings final and use Settings instead of strings 2016-04-07 12:55:25 -06:00
Lee Hinman 38d6ae1e20 Merge commit '8e01b093d0307a67a09bcb238452078becb62707' into dakrone/disk-info-ignore-shadow-size 2016-04-07 11:35:51 -06:00
Igor Motov 81c59cae18 Add _cat/tasks
Adds new _cat endpoint that lists all tasks
2016-04-07 09:28:21 -06:00
Jason Tedor 6a0e2d1f2d Remove leftover forbidden suppression in ZD 2016-04-07 11:22:29 -04:00
Adrien Grand c33300c543 Make MappedFieldType responsible for providing a parser/formatter. #17546
Aggregations need to perform instanceof calls on MappedFieldType instances in
order to know how they should be parsed or formatted. Instead, we should let
the field types provide a formatter/parser that can can be used.
2016-04-07 16:57:50 +02:00
jaymode f9d1e8a5f3 Root rest api delegates to a transport action
This change makes the root (/) rest api delegate to a transport action to get the
data for the response. This aligns this rest api with all of the other apis, which
delegate to one or more actions.

In doing this, unit tests were added to provide coverage of the RestMainAction
and the associated classes.
2016-04-07 10:03:49 -04:00
Adrien Grand e1bfe23c22 ExtendedStatsAggregator should also pass sigma to emtpy aggs. #17388
Because sigma is also used at reduce time, it should be passed to empty aggs.
Otherwise it causes bugs when an empty aggregation is used to perform reduction
is it would assume a sigma of zero.

Closes #17362
2016-04-07 09:34:11 +02:00
Jason Tedor 0a69985153 Merge pull request #17038 from jasontedor/enable_acked
Prepare for enabling acked indexing
2016-04-06 18:13:28 -04:00
Nik Everett 4841c5a3d3 Cut CustomQueryParserIT to registerQuery
This is the last place inside of ES other than SearchModule.
2016-04-06 16:38:56 -04:00
Jimmy Jones f157dae053 Disallow unquoted field names, fix testcases using unquoted JSON 2016-04-06 14:37:15 -06:00
Martijn van Groningen 63261f14d4 test: better fix for: 78d2311c5f 2016-04-06 22:23:00 +02:00
Martijn van Groningen ec4ebf31b0 Revert "test: don't do fuzzy on bool field"
This reverts commit 78d2311c5f.
2016-04-06 22:18:57 +02:00
Martijn van Groningen 5ff68d173d Removed unneeded refresh during post recovery.
and removed an obsolete exception, `_percolator` type is now `.percolator` since version 1.0
2016-04-06 22:06:14 +02:00
Adrien Grand 57059f1410 Fail if an object is added after a field with the same name. #17568
Today we fail if you try to add a field and an object from another type already
has the same name. However, we do NOT fail if you insert the field first and the
object afterwards. This leads to bad bugs since mappings are not necessarily
parsed in the same order at recovery time, so a mapping update could succeed and
then you would fail to reopen the index.
2016-04-06 20:16:11 +02:00
Jason Tedor 95feb40bef Remove superfluous validation of incoming states
This commit removes a superfluous check when validing incoming cluster
states. The check in question prevents out-of-order cluster states from
the same master from entering the queue. However, such out-of-order
cluster states will be cleaned from the queue when a commit message for
that cluster state arrives or a commit message for any higher-versioned
cluster state arrives.
2016-04-06 13:53:21 -04:00
Michael McCandless 8a9b5ccbc4 Merge pull request #17569 from mikemccand/imc_version_conflict_recovery
NullPointerException from IndexingMemoryController when a version conflict happens during recovery
2016-04-06 13:47:00 -04:00
Mike McCandless dea3678ef9 handle null Engine.Operation.getTranslogLocation in IndexingMemoryController 2016-04-06 13:34:01 -04:00
Nik Everett 16c12afabe Rework ScoreFunctionBuilder registration to remove PROTOTYPEs
This removes PROTOTYPEs from ScoreFunctionsBuilders. To do so we rework
registration so it doesn't need PROTOTYPEs and lines up with the recent
changes to query registration.
2016-04-06 13:04:11 -04:00
Nik Everett 1afc9b7e56 Cut multi_match query to registerQuery 2016-04-06 12:30:05 -04:00
Nik Everett f61c29e67b Move more queries to registerQuery 2016-04-06 11:51:06 -04:00
Nik Everett 03ce5e19eb 4 more queries 2016-04-06 11:15:23 -04:00
Nik Everett 2b6866d26b Fix references to the removed parsers
Mostly stuff is just in the builder now.
2016-04-06 11:15:22 -04:00
Nik Everett c68a58b67e Move the bottom third of queries to registerQuery
Mostly this is just moving fromXContent, making it public, and moving
the ParseFields used in parsing and making them private.
2016-04-06 11:15:22 -04:00
Colin Goodheart-Smithe c5ce78ed44 Aggregations: Fixes NPE when no window is specified in moving average request
This PR fixes a bug where a NPE was thrown when parsing a moving average pipeline aggregation request which did not specify a window size.

Closes #17516
2016-04-06 15:56:26 +01:00
Martijn van Groningen 78d2311c5f test: don't do fuzzy on bool field 2016-04-06 16:49:26 +02:00
Christoph Büscher bdc70df319 Merge pull request #17547: Add shuffling xContent to aggregation tests
This adds shuffling of xContent similar to #17521 to the aggregation and pipeline aggregation base test.
The additional shuffling uncovered that some aggregation builders internally store some properties in a 
way that made the equals() testing fail when the xContent is shuffled.
For TopHitsAggregatorBuilder, the internal scriptFields parameter was changed to a set because the order 
they appear in the xContent should not matter. For FiltersAggregatorBuilder, the internal list of KeyedFilters 
is sorted by key now. As a side effect, the keys in the aggregation response are now not always in the same 
order as the filters in the query, but sorted by key as well (unless they are anonymous).
2016-04-06 14:09:36 +02:00
James Bertouch 3651854bf6 Enhanced lat/long error handling
NumberFormatExceptions caused by non-double lat/long values are now
handled when the ignore_malformed flag is set to true.

Closes #16833
2016-04-06 07:14:01 -04:00
Christoph Büscher f409d0b763 Make defensive copies of filters list internally 2016-04-06 11:40:08 +02:00
Igor Motov f599ac5d5a Expose whether a task is cancellable in the _tasks list API
Closes #17369
2016-04-05 19:16:08 -06:00
Jason Tedor e76038e076 Exploit DiscoveryNode immutability in toString
DiscoveryNode is immutable yet we rebuild DiscoveryNode#toString on
every invocation. Most importantly, this just leads to unnecessary
allocations. This is most germane to ZenDiscovery and the processing of
cluster states where DiscoveryNode#toString is invoked when submitting
update tasks and processing cluster state updates.

Closes #17543
2016-04-05 19:17:04 -04:00
Christoph Büscher cbcbe75cf0 Adressing comments 2016-04-06 00:05:26 +02:00
Jason Tedor 66cc2029cd Refactor old state version check to ZenDiscovery 2016-04-05 17:31:36 -04:00
Jason Tedor c2ed5a1c9e Reorder pending queue clean checks 2016-04-05 15:59:54 -04:00
Jason Tedor 3abf8177e8 Add comment about older cluster states 2016-04-05 15:56:16 -04:00
Christoph Büscher b01e3f0d3b Add shuffling xContent to aggregation tests 2016-04-05 19:33:52 +02:00
Jason Tedor 7cdd647d7b Clarify cluster state local node validation 2016-04-05 13:04:34 -04:00
Colin Goodheart-Smithe 65a5366cba Aggregations: Fixes Filter and FiltersAggregation to work with empty query
This fix ensures the filter and filters aggregation will not throw a NPE when `{}` is passed in as a filter. Instead `{}` is interpreted as a MatchAllDocsQuery.

Closes #17518
2016-04-05 17:20:29 +01:00
Jason Tedor cffc315dca Reject old cluster states and keep the queue clean
This commit adds a guard preventing old cluster states from entering
into the pending queue when we are following a master, and cleans old
cluster states from the pending queue when processing a commit.
2016-04-05 11:03:29 -04:00
Luca Cavanna 67ccfc354e Switch to using ParseField to parse query names
* [TEST] check registered queries one by one in SearchModuleTests

* Switch to using ParseField to parse query names

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

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

Every QueryParser holds now a ParseField constant called QUERY_NAME_FIELD that holds the name for it. The first name is the preferred one, all the others are deprecated. The first name is taken from the NAME constant already present in each query builder object, so that we somehow keep the serialization constant separated from ParseField. This change also allowed us to remove the names method from the QueryParser interface.
2016-04-05 15:38:53 +02:00
Colin Goodheart-Smithe 84eacadd51 Splits `phrase` and phrase_prefix` in match query into `MatchPhraseQueryBuilder` and `MatchPhrasePrefixQueryBuilder`
The `phrase` and `phrase_prefix` options in the `MatchQueryBuilder` have been deprecated in favour of using the new `MatchPhraseQueryBuilder` and `MatchPhrasePrefixQueryBuilder`. This is not a breaking change since `MatchQueryBuilder` still supports `phrase` and `phrase_prefix` but this option will be removed from the `MatchQueryBuilder` in the future (probably in 6.0)

Relates to https://github.com/elastic/elasticsearch/pull/17458#discussion_r58351998
2016-04-05 12:55:03 +01:00
Jim Ferenczi 6c8d9acc75 Merge pull request #17530 from jimferenczi/bwc_2.3.1
Replace problematic bwc indices for 2.3.1 with newly generated one.
2016-04-05 11:19:43 +02:00
Christoph Büscher 7254eac840 Add more fromXContent() testing with shuffled field order 2016-04-05 10:07:51 +02:00
Jim Ferenczi 0225376a49 Replace problematic bwc indices for 2.3.1 with newly generated one.
Restore the test OldIndexBackwardsCompatibilityIT.testOldIndexes which now works fine with 2.3.1 bwc indices.
2016-04-05 09:50:34 +02:00
Lee Hinman 05e2358ffb Fail hot_threads in a better way if unsupported by JDK
Currently if thread cpu time is not supported (for instance, on
operating systems such as FreeBSD), an `IllegalStateException` is thrown
in `HotThreads#innerDetect()` that causes the API to return a useless
response.

This changes the check to be earlier, substituting a message for the
hot_threads output (in case some nodes *do* support it).

Additionally, if an exception is thrown during the hot_threads
generation it is now logged and the best effort output is returned.
2016-04-04 15:36:21 -06:00
Zachary Tong 0a472cb359 [TEST] Temporarily silence failing bwc test
More details at #17514
2016-04-04 16:17:24 -04:00
Lee Hinman 78e6ff6e5e Show configured and remaining delay for an unassigned shard.
When a shard is delayed, we now show output like:

```json
{
  "shard" : {
    "index" : "i",
    "index_uuid" : "QzoKda9aQCG_hCaZQ18GEg",
    "id" : 3,
    "primary" : false
  },
  "assigned" : false,
  "unassigned_info" : {
    "reason" : "NODE_LEFT",
    "at" : "2016-04-04T16:44:47.520Z",
    "details" : "node_left[HyRLmMLxR5m_f58RKURApQ]"
  },
  "allocation_delay" : "59.9s",
  "allocation_delay_ms" : 59910,
  "remaining_delay" : "38.9s",
  "remaining_delay_ms" : 38991,
  "nodes" : {
    "jKiyQcWFTkyp3htyyjxoCw" : {
      "node_name" : "Landslide",
      "node_attributes" : { },
      "final_decision" : "YES",
      "weight" : 1.0,
      "decisions" : [ ]
    },
    "9bzF0SgoQh-G0F0sRW_qew" : {
      "node_name" : "Caretaker",
      "node_attributes" : { },
      "final_decision" : "NO",
      "weight" : 2.0,
      "decisions" : [ {
        "decider" : "same_shard",
        "decision" : "NO",
        "explanation" : "the shard cannot be allocated on the same node id [9bzF0SgoQh-G0F0sRW_qew] on which it already exists"
      } ]
    }
  }
}
```

Where the new addition is this section:

```
  "allocation_delay" : "59.9s",
  "allocation_delay_ms" : 59910,
  "remaining_delay" : "38.9s",
  "remaining_delay_ms" : 38991,
```

Which shows the configured delay as well as the remaining delay until
the shard can be considered "assignable". This data is only shown if the
shard is unassigned.

Relates to #17372
2016-04-04 11:37:29 -06:00
Nik Everett 90f300bb71 Remove PROTOTYPE from some enums in query builders 2016-04-04 13:19:36 -04:00
Clinton Gormley b7fb34fed2 Bumped current version to 2.3.2-SNAPSHOT and added bwc indices for 2.3.1 2016-04-04 17:45:27 +02:00
Lee Hinman 8e01b093d0 When considering the size of shadow replica indices, set size to 0
Otherwise, when trying to calculate the amount of disk usage *after* the
shard has been allocated, it has incorrectly subtracted the shadow
replica size.

Resolves #17460
2016-04-04 08:28:03 -06:00
Luca Cavanna f75086fcee ParseField#getAllNamesIncludedDeprecated to not return duplicate names 2016-04-04 15:08:43 +02:00