Commit Graph

2594 Commits

Author SHA1 Message Date
Alexander Reelsen b6d2be7a51 Improving test stability for CompletionTests
Randomized testing caught an issue showing that the test should
flush after indexing a document, as always the same document is
indexed.
2013-10-29 13:11:34 +01:00
Luca Cavanna 9e6fab3a6d Added support for acknowledgements to update cluster settings api
As a side note, the internal reroute call is now part of the ack mechanism. That means that if the response contains acknowledged flag, the internal reroute that was eventually issued was acknowledged too. Also, even if the request is not acknowledged, the reroute is issued before returning, which means that there is no need to manually call reroute afterwards to make sure the new settings are immediately applied.

Closes #3995
2013-10-29 11:45:59 +01:00
Luca Cavanna d10bd2495d Added support for acknowledgements to cluster reroute api
Closes #3985
2013-10-29 11:45:59 +01:00
Luca Cavanna f23a1e23b1 Added support for node acknowledgements in delete mapping api
Closes #3984
2013-10-29 11:45:59 +01:00
Luca Cavanna 5f1ebf20f7 Added support for acknowledgement in update index settings api
Added support for serialization based on version to AcknowledgedResponse. Useful in api that don't support yet the acknowledged flag in the response.
Moved also ack warmer tests to more specific AckTests class

Close #3983
2013-10-29 11:45:59 +01:00
Luca Cavanna f425d4af2f Added ack call when the cluster state has not changed
The missing call could cause a cluster state update to hang in case there is no change no apply
2013-10-29 11:45:58 +01:00
Luca Cavanna 5639002a8e Fixed test cluster scope to be able to run it multiple times if needed 2013-10-29 11:10:31 +01:00
Igor Motov 01d51ef434 Fix String.format to use Locale.ROOT in RestRecoveryAction 2013-10-28 23:37:11 -04:00
David Pilato 5d90abf701 mget API should support global routing parameter
mget API support `_routing` field but not `routing` parameter.

Reproduction here:

```sh
curl -XDELETE "http://localhost:9200/test/"; echo
curl -XPUT "http://localhost:9200/test/" -d'{
   "settings": {
      "number_of_replicas": 0,
      "number_of_shards": 5
   }
}'; echo

curl -XPUT 'http://localhost:9200/test/order/1-1?routing=key1' -d '{
   "productName":"doc 1"
}'; echo
curl -XPUT 'http://localhost:9200/test/order/1-2?routing=key1' -d '{
   "productName":"doc 2"
}'; echo
curl -XPUT 'http://localhost:9200/test/order/1-3?routing=key1&refresh=true' -d '{
   "productName":"doc 3"
}'; echo

curl -XPOST 'http://localhost:9200/test/order/_mget?pretty' -d '{
    "docs" : [
        {
            "_index" : "test",
            "_type" : "order",
            "_id" : "1-1",
            "_routing" : "key1"
        },
        {
            "_index" : "test",
            "_type" : "order",
            "_id" : "1-2",
            "_routing" : "key1"
        },
        {
            "_index" : "test",
            "_type" : "order",
            "_id" : "1-3",
            "_routing" : "key1"
        }
    ]
}'; echo

curl -XPOST 'http://localhost:9200/test/order/_mget?pretty&routing=key1' -d '{
	"ids": [
		"1-1",
		"1-2",
		"1-3"
	]
}'; echo
```

Closes #3996.
2013-10-28 21:05:55 +01:00
Lee Hinman e3db12bf50 Add the 'recovery' _cat API endpoint
This addes the _cat/recovery/{index} API endpoint, which displays
information about the status of recovering shards. An example of the
output:

index shard node                   target    recovered     %
test2 0     Fwo7c_6MSdWM0uM1Ho4t-g 147304414  19236101 13.1%
test  0     Fwo7c_6MSdWM0uM1Ho4t-g 145891423 119640535 82.0%

Fixes #3969
2013-10-28 13:43:02 -06:00
Alexander Reelsen b1b52b641d Making unit test future proof by using old version, in case versions change 2013-10-28 18:46:46 +01:00
Alexander Reelsen ec0880df45 Add version to prebuilt analyzers
This patch takes the version of the created index into account when a
prebuilt analyzer is created.
So, if an index was created with 0.90.4, then the prebuilt analyzers
will be the same than on the 0.90.4 release.

One reason for this feature is the possibility to change pre built
analyzers like the standard one.

The patch tries to reuse analyzers as mutch as possible. So even if
version X.Y.Z and X.Y.A use the same lucene analyzers, the same instance
is reused in order to prevent overcreation of lucene analyzer instances.

Closes #3790
2013-10-28 18:11:35 +01:00
Britta Weber c9dab6991e rename and document "index.mapping.date.parse_upper_inclusive" setting for date fields
The setting causes the upper bound for a range query/filter to be rounded up,
therefore the name `round_ceil` seems to make more sense.

Also this commit removes the redundant fourth parameter to DateMathParser.parse(..)
which was never used.
was:    parse(String text, long now, boolean roundUp, boolean upperInclusive)
is now: parse(String text, long now, boolean roundCeil)

closes #3914
2013-10-28 15:48:31 +01:00
Adrien Grand 2e8bbe9e30 Make ContextIndexSearcher delegate more method calls to Engine.searcher().
When running tests, Engine.searcher() is going to be an AssertingIndexSearcher
so we definitely don't want to discard it. This commit fixes it as well as the
bugs it found.

Closes #3987
2013-10-28 13:12:09 +01:00
Simon Willnauer ce891e93b6 Assert on failures in QueryRescorerTests 2013-10-28 11:09:48 +01:00
Boaz Leskes 6b52391dbd Added a ClusterHealthResponse.toString implementation for better error reporting in FullRollingRestartTests timeout failures. 2013-10-28 09:54:54 +01:00
Boaz Leskes 68de46ff05 Use XContentParser.isBooleanValue to detect all boolean values for the `_source` parameter for both _mget and _search
Closes #3981
2013-10-26 22:19:05 +02:00
Boaz Leskes 0f8149dca4 Added Booleans.isBoolean to allow detecting whether a char sequence contains a boolean value. Added XContentParser.isBooleanValue to allow testing if current value is of boolean nature.
Boolean values:
boolean type values
numeric (0 == false)
one of the following strings: "true","false","on","off","yes","no","0","1"
2013-10-26 22:15:35 +02:00
Simon Willnauer 2255ecc980 Don't use TransportClient on FullClusterRestartTests
There seems to be an issue with this test since it shuts down random
nodes and TransportClients seem to be confused due to that. For
now we disable them to figure out if this is the cause of the sporadic
timeouts.
2013-10-25 22:04:44 +02:00
Adrien Grand b0b3748cae Re-apply pull-request #3956 now that the CLA has been signed. 2013-10-25 19:05:20 +02:00
Alexander Reelsen f9154de04f CompletionFieldMapper: Return error if weight is no integer
In order to make sure that people do not get confused, if they
index a float as weight, it makes more sense to reject it instead of
silently parsing it to an integer and using it.

The CompletionFieldMapper now checks for the type of the number which
is being read and throws and exception if the number is something else
than int or long.

Closes #3977
2013-10-25 16:38:50 +02:00
Simon Willnauer e79f714b4b Unify REST responses for Acknowledged[Request|Response]
All Rest handlers that use AcknowledgedResponse look identical. Since
we gonna have more of them in the future we can abstract the logic away.
2013-10-25 14:31:28 +02:00
Helton Alponti 0e9c049da1 Fixed NPE in multi_match query when using lenient and field weight
Closes #3797
2013-10-25 00:49:17 +02:00
Luca Cavanna 48ac9747a8 Added third highlighter type based on lucene postings highlighter
Requires field index_options set to "offsets" in order to store positions and offsets in the postings list.
Considerably faster than the plain highlighter since it doesn't require to reanalyze the text to be highlighted: the larger the documents the better the performance gain should be.
Requires less disk space than term_vectors, needed for the fast_vector_highlighter.
Breaks the text into sentences and highlights them. Uses a BreakIterator to find sentences in the text. Plays really well with natural text, not quite the same if the text contains html markup for instance.
Treats the document as the whole corpus, and scores individual sentences as if they were documents in this corpus, using the BM25 algorithm.

Uses forked version of lucene postings highlighter to support:
- per value discrete highlighting for fields that have multiple values, needed when number_of_fragments=0 since we want to return a snippet per value
- manually passing in query terms to avoid calling extract terms multiple times, since we use a different highlighter instance per doc/field, but the query is always the same

The lucene postings highlighter api is  quite different compared to the existing highlighters api, the main difference being that it allows to highlight multiple fields in multiple docs with a single call, ensuring sequential IO.
The way it is introduced in elasticsearch in this first round is a compromise trying not to change the current highlight api, which works per document, per field. The main disadvantage is that we lose the sequential IO, but we can always refactor the highlight api to work with multiple documents.

Supports pre_tag, post_tag, number_of_fragments (0 highlights the whole field), require_field_match, no_match_size, order by score and html encoding.

Closes #3704
2013-10-24 23:38:00 +02:00
Simon Willnauer 08b4ca66c3 Use at least one query to prevent division by zero in PercolatorFacetsTests 2013-10-24 21:45:12 +02:00
Britta Weber ebd328e340 remove trove import from mvel script
all subclasses of trove maps have been removed in 088e05b368
2013-10-24 19:44:45 +02:00
Simon Willnauer 3a34aa735e Upgrade to Lucene 4.5.1 2013-10-24 18:37:44 +02:00
Luca Cavanna 8e6c4ce8e8 Minor changes to no_match_size highlight parameter and highlight tests (#1171)
- Randomly store the field to highlight
- Updated test to use common assertions
- Restored previously commented out testCommonTermsQuery
2013-10-24 14:38:32 +02:00
Nik Everett 14a709f563 Highlighting can return excerpt with no highlights
You can configure the highlighting api to return an excerpt of a field
even if there wasn't a match on the field.

The FVH makes excerpts from the beginning of the string to the first
boundary character after the requested length or the boundary_max_scan,
whichever comes first.  The Plain highlighter makes excerpts from the
beginning of the string to the end of the last token before the requested
length.

Closes #1171
2013-10-24 14:38:32 +02:00
Simon Willnauer fb9cd5a562 Use abstract classes as super typs for Acknowledge operations
Currently we have a marker interface for Acknowledged[Request|Response],
this makes not much sense since we duplicate the code in each subclass
or class that implements the interface. We can simply use abstract
classes and have it implemented only once.
2013-10-24 14:01:43 +02:00
Simon Willnauer 7867de4f5b Refactor FieldData iterations
This commit primarily folds [Double|Bytes|Long|GeoPoint]Values.Iter
into [Double|Bytes|Long|GeoPoint]Values. Iterations now don't require
a auxillary class (Iter) but instead driven by native for loops. All
[Double|Bytes|Long|GeoPoint]Values are stateful and provide `setDocId`
and `nextValue` methods to iterate over all values in a document.
This has several advantage:

 * The amout of specialized classes is reduced
 * Iteration is clearly stateful ie. Iters can't be confused to be local.
 * All iterations are size bounded which prevents runtime checks and
   allows JIT optimizations / loop un-rolling and most iterations are
   branch free.
 * Due to the bounded iteration the need for a `hasNext` method call
   is removed.
 * Value iterations feels more native.

This commit also adds consistent documentation and unifies the calcualtion
if SortMode is involved.

This commit also changes the runtime behavior of BytesValues#getValue() such that it
will never return `null` anymore. If a document has no value in a field
this method still returns a `BytesRef` with a `length` of 0. To identify
documents with no values #hasValue() or #setDocument(int) should be used.
The latter should be preferred if the value will be consumed in the case
the document has a value.
2013-10-24 10:33:56 +02:00
Adrien Grand 7bd1a55f6e Revert "Fix for has_child can cause an infinite loop (100% CPU) when used in bool query."
Temporarily revert the commit while waiting for the CLA to be signed.
2013-10-24 09:43:58 +02:00
Josh Canfield adadc72da3 Fix for has_child can cause an infinite loop (100% CPU) when used in bool query.
Closes #3955
2013-10-24 09:24:14 +02:00
Shay Banon 35b573ff24 Transport: Have a separate channel for recovery
Have a separate channel for recovery, so it won't overflow the "low" channel which is also used for bulk indexing.

Also, rename the channel names to be more descriptive. Change low to bulk (for bulk based operations, currently just bulk indexing), med to reg (for "regular" operations), and high to state (for state based communication). The new channel for recovery will be named recovery, and the ping channel will remain the same.

closes #3954
2013-10-23 15:55:27 -07:00
Adrien Grand d18192b39f Add doc values to TermsFacetSearchBenchmark. 2013-10-23 10:58:35 +02:00
Shay Banon a3122a88e4 Java API: Setting track scores does not affect scan search type
When setting track scores, the scan search type will return the scores for each document. The Java API builder does not properly set this value (it only sets it if a sort in in place, which is not relevant for scan search type).

closes #3949
2013-10-22 18:04:22 -07:00
Shay Banon 5bc3825c70 externalize writing "raw" fields to helper method 2013-10-21 12:19:14 -07:00
Martijn van Groningen 8d49aa398f Added facet support to the percolate api.
Closes #3851
2013-10-21 19:13:28 +07:00
Luca Cavanna b7d8c275eb Fix small typo in terms lookup tests mapping (count api tests) 2013-10-18 17:55:21 +02:00
Matt Weber e6fc416adc Fix small typo in terms lookup tests mapping. 2013-10-18 17:55:21 +02:00
Simon Willnauer f749db26e8 Allow awareness attributes to be reset via the API
Currently we don't allow resetting the awareness
attribute via the API since it requires at least one
non-empty string to update the setting. This commit
allows resetting this using an empty string.

Closes #3931
2013-10-18 16:25:00 +02:00
Blake Smith 03a89297ba Fix teh typos in javadocs 2013-10-18 12:19:37 +02:00
Shay Banon c9b0e1de6c Settings queue_size on index/bulk TP can cause rejection failures when executed over network
The #3526 fix was not complete, it handled cases of on node execution, but didn't properly handle cases where it was executed over the network, and forcing the execution of the replica operation when done over the wire.

This relates to #3854

closes #3929
2013-10-17 17:06:44 +03:00
Boaz Leskes 2593b6e644 Terms facet will now throw a parsing exception if no field, fields or a script is supplied.
Previously you'd get an NPE. Also added extra exception when called with unknown parameters.
2013-10-17 09:26:43 +02:00
Martijn van Groningen cc9ab111a0 Prohibit indexing a document with parent for a type that doesn't have a `_parent` field configured and prohibit adding a _parent field to an existing mapping.
Closes #3848 #3849
2013-10-15 18:29:44 +02:00
Simon Willnauer 89de3ab627 Added simple count down class that allows to be fast forwarded
Closes #3910
2013-10-15 17:47:51 +02:00
Luca Cavanna fcf13e0fa7 Delete warmer api to support acknowledgements
Added support for acknowledgements in delete warmer api using the generic mechanism introduced in#3786

Closes #3833
2013-10-15 17:47:50 +02:00
Luca Cavanna 31142ae471 Put warmer api to support acknowledgements
Added support for acknowledgements in put warmer api using the generic mechanism introduced in #3786

Closes #3831
2013-10-15 17:47:50 +02:00
Luca Cavanna 55f1eab09a Added generic cluster state update ack mechanism
Added new AckedClusterStateUpdateTask interface that can be used to submit cluster state update tasks and allows actions to be notified back when a set of (configurable) nodes have acknowledged the cluster state update. Supports a configurable timeout, so that we wait for acknowledgement for a limited amount of time (will be provided in the request as it curently happens, default 10s).

Internally, a low level AckListener is created (InternalClusterService) and passed to the publish method, so that it can be notified whenever each node responds to the publish request. Once all the expected nodes have responded or the timeoeout has expired, the AckListener notifies the action which will return adding the proper acknowledged flag to the response.

Ideally, this new mechanism will gradually replace the existing ones based on custom endpoints and notifications (per api).

Closes #3786
2013-10-15 17:47:50 +02:00
Alexander Reelsen 4d19239ec4 Add support for Lucene SuggestStopFilter
The suggest stop filter is an improved version of the stop filter, which
takes stopwords only into account if the last char of a query is a
whitespace. This allows you to keep stopwords, but to allow suggesting for
"a".

Example: Index document content "a word". You are now able to suggest for
"a" and get back results in the completion suggester, if the suggest stop
filter is used on the query side, but will not get back any results for
"a " as this is identified as a stopword.

The implementation allows to set the `remove_trailing` parameter for a
custom stop filter and thus use the suggest stop filter instead of the
standard stop filter.
2013-10-15 16:12:02 +02:00