Commit Graph

5244 Commits

Author SHA1 Message Date
Martijn van Groningen 3c58176d29 Also support `sum` as `score_mode` option for the nested query.
Relates to #3026
2013-05-13 10:38:20 +02:00
Martijn van Groningen 6eaad25621 Made all the queries support `score_mode` parameter name in addition to the existing parameter name for score mode.
Closes #3026
2013-05-13 10:30:01 +02:00
Martijn van Groningen bacf969dd3 Improved the stability of hl tests by adding waiting for at least yellow status.
In some test cases this was missing.
2013-05-13 10:18:36 +02:00
Shay Banon 21d749a6aa resolved empty setting values should be removed
when resolving empty settings values, their value should be removed, for example, when using ${env.ENV_VAR}, and ENV_VAR is not set, then the setting should be removed
2013-05-12 05:18:03 +02:00
Shay Banon 2ab72da7d6 update to joda 2.2 2013-05-11 23:37:56 +02:00
Shay Banon e09e3eb73b upgrade to mvel 2.1.5 2013-05-11 23:17:00 +02:00
Shay Banon ee636c2330 use throwable in transport layer
catch throwable when processing messages in the transport layer, to report back failures even under errors
2013-05-11 21:30:16 +02:00
Shay Banon 342e9cf18e test no longer needed... 2013-05-11 01:22:23 +02:00
Shay Banon 6e26efcd87 not active shards should translate to 503 not 500 2013-05-10 18:09:42 +02:00
Alexander Reelsen 21fcc482eb Allow to set headers in HTTP response
This commit allows to set custom headers in HTTP responses (like
setting the WWW-Authenticate header for basic auth) by adding
RestRequest.addHeader() method.

Closes #2936
Closes #2540

To get the history right: This is based on PR #2723
2013-05-10 17:58:46 +02:00
Shay Banon da5dff9ee4 remove concrete bytes for field data
no really need for it, specifically with the fact that we don't need to deepCopy on makeSafe for the (default) paged bytes
2013-05-10 17:42:34 +02:00
Shay Banon 455b5da52f No need for deepCopy on makeSafe for pages field data
Since its a reference to a buffer in the PagedBytes, we don't need to deep copy it on makeSafe, just shallow copy it
2013-05-10 17:25:39 +02:00
Martijn van Groningen 2be23d2427 Added test that checks if a validation error is thrown when both doc and script provided in a update request.
Closes #2967
2013-05-10 16:43:20 +02:00
Alexander Kahn 47971ac808 Reject update request that has both script and doc 2013-05-10 16:31:54 +02:00
Martijn van Groningen 9ddd675a02 Added support for the update operation in the bulk api.
Update requests can now be put in the bulk api. All update request options are supported.

Example usage:
```
curl -XPOST 'localhost:9200/_bulk' --date-binary @bulk.json
```

Contents of bulk.json that contains two update request items:
```
{ "update" : {"_id" : "1", "_type" : "type1", "_index" : "index1", "_retry_on_conflict" : 3} }
{ "doc" : {"field" : "value"} }
{ "update" : { "_id" : "0", "_type" : "type1", "_index" : "index1", "_retry_on_conflict" : 3} }
{ "script" : "counter += param1", "lang" : "js", "params" : {"param1" : 1}, "upsert" : {"counter" : 1}}
```
The `doc`, `upsert` and all script related options are part of the payload. The `retry_on_conflict` option is part of the header.

Closes #2982
2013-05-10 16:03:24 +02:00
Shay Banon c5e177dc56 lazy compute the hash and actually use it... 2013-05-10 11:51:55 +02:00
Igor Motov 4d66575abe Make GetField behavior more consitent for multivalued fields.
Before this change, the GetField#getValue() method was returning a list of values of a multivalued fields if the field values were obtained from source or if the field was stored and real-time get was used. If the field was stored but non-realtime get was used, GetField#getValue() was returning only the first element and the GetField#getValues() was returning a list of elements. This change makes behavior consistent. GetField#getValue() now always returns only the first value of the field and GetField#getValues() returns the entire list.
2013-05-09 12:45:49 -04:00
Shay Banon 522ca7e889 upgrade to jackson 2.2.1 2013-05-09 18:00:23 +02:00
Igor Motov d69dd321fc Improve test stability 2013-05-09 10:21:21 -04:00
Shay Banon 8a2e5bbe68 Reroute Allocate to force primary allocation when enabled
Typically, the main reason a reroute allocation command with allow_primary is enabled, is to force create an empty new shard because a shard (and its replicas) were lost. This can't be done today because the shard expects to have a valid index where its allocated, we need to clear its post allocation flag to make sure it is allowed to create a fresh index.
2013-05-09 00:47:57 +02:00
Igor Motov 15c8510e65 Fix DfsSearchResult method names in AggregatedDfs 2013-05-08 18:21:47 -04:00
Simon Willnauer 436e23b8d4 Use simplified asserts and better naming
addOne / subOne are likely easier to understand without reading the docs.
If I would read my emails this would have made it in the last commit.
2013-05-08 22:06:01 +02:00
Simon Willnauer 1ef8761b70 Handle optional term and field statistics gracefully
Lucene provides a set of statistics that depend on the codec / postingsformat
as well as on the index options used when the field is created / indexed.
If a certain stats value is not available lucene return `-1` instead of the
correct value. We need to ensure that those values are encoded correctly if
we try to write vLongs as well as when we aggregate those values.

Closes #3012
2013-05-08 21:34:48 +02:00
Igor Motov dbaf39c792 Add more informative toString method to StoreDirectory 2013-05-08 12:05:40 -04:00
Simon Willnauer a89230945f Add NGramTokenizer and NGramTokenFilter to broken chains
NgramTokenizer and NGramTokenFilter are broken with a version < 4.2
We should still support these filters but should prevent the StringIOOB
exceptions. Adding these fitlers for the FragmentBuilderHelper will
allow seamless highlighting on fields indexed with those tokenizers or
tokenfilters
2013-05-08 17:57:20 +02:00
chilling b7cd8a64cd Merge pull request #3009 from chilling/issue2986_scores
Fixed parsing of track_scores in RestSearchAction
2013-05-08 03:54:16 -07:00
Florian Schilling 19fab7cd0e Fixed parsing of `track_scores` in `RestSearchAction`
Closes #2986
2013-05-08 12:45:32 +02:00
Simon Willnauer c1e8d4787a Don't use smart query wrapping for span term query
Lucenes span queries are a different family than 'ordinary' queries
in lucene. Spans only work with other spans such that smart query
wrapping doesn't work with span queries at all ie. we can't wrap
in filtered query.

Closes #2994
2013-05-07 22:52:57 +02:00
Simon Willnauer 992a40cbd8 Add `field_masking_span` to IndexQueryModule
The query parser for `field_masking_span` has never been added / bound to
the IndexQueryModule.

Closes #3007
2013-05-07 21:50:47 +02:00
Igor Motov 32abf6b890 Fix error getting array fields
Fixes #3000
2013-05-07 13:30:29 -04:00
Simon Willnauer 130f0f6afd Remove Java 7 only API
We still run on Java 6 as minimum requirement. Integer.compare(int,int)
was added in Java 7. This caused compile errors on CI.
2013-05-07 18:40:56 +02:00
uboness 74317fec8b Fixed custom hunspell dictionary directory
Properly loading dictionaries from based on the "indices.analysis.hunspell.dictionary.location" setting if one exists
2013-05-07 17:21:37 +02:00
Simon Willnauer e1b66b34ea Don't fail hard if broken analysis is used.
Today an analysis chain with broken tokenfilters or tokenizers like
WordDelimiterFilter might produce somewhat broken term vectors that cause
`StringIndexOutOfBoundsExceptions` if FastVectorHighlighter is used
since the positions / offsets contract is violated and offsets of highlight
tokens are not increasing but decreasing even if their positions are increasing.

Yet, if we detect such a situation we can resort the tokens which might cause
somewhat odd highlights but doesn't fail hard with a StringIndexOOBException.

Closes #3006
2013-05-07 16:29:00 +02:00
uboness 14ae2fb765 Changed the priority of delete-index action to URGENT
All index meta data API's have urgent priority when it comes to cluster state updates. We'd like to remove indices asap to avoid things like unnecessary shards relocations
2013-05-07 05:43:08 +02:00
Simon Willnauer 758a4fcdc0 Enable Geo-Shape Relations Within and Disjoint 2013-05-06 18:03:16 +02:00
Simon Willnauer 2219925485 Upgrade to Lucene 4.3.0
This Lucene Release introduced a new API on DocIdSetIterator that requires each
implementation to return a `cost` upperbound as a function of the iterated documents.
This API allows for several optimizations during query execution especially in
Conjunction and Disjunction Queries with min_should_match set.

Closes #2990
2013-05-06 18:03:16 +02:00
Shay Banon f566527513 Rest Get Source
Allow to get the source directly using a specific REST endpoint without any additional content around it, the endpoint is `{index}/{type}/{id}/_source`.
Note, HEAD now also support the _source endpoint.
closes #2993, closes #2995
2013-05-06 14:33:23 +02:00
Derek McNeil fbd732cde2 Added support for Collections in TermsQuery/InQuery. 2013-05-06 10:30:30 +02:00
Simon Willnauer 3c995d5dcc Expose Lucene Main Version via Main Action. A call to `/` will
return the version of the used Lucene library next to the Elasticsearch
version.

Closes #2988
2013-05-06 09:48:08 +02:00
Simon Willnauer 29da615afd Use full ord range in binary search. The upperbound of the binary search in
BytesRefOrdValComparator starts at 1 and ends at maxOrd - 1. Yet, numOrd is defined
as maxOrd - 1 excluding the 0 ord.

This causes wrong sort ords when the bottom of the queue is compared to the next
segment and the greatest term in the new segment is in-fact less than the current
queue bottom. If that is true we treat the values as equal and never include the right
value into the queue.

Closes #2991
2013-05-05 00:48:10 +02:00
Igor Motov f92c53efdb Accept loopback interfaces in the network.host setting
Closes #2924. Adds support for loopback interfaces such as _lo0_ in network.host and other network settings.
2013-05-03 14:36:49 -04:00
Martijn van Groningen f22510cab5 A neater approach of for processing should clauses before must or must_not clauses. 2013-05-03 18:25:32 +02:00
Martijn van Groningen 52edc4c652 Fixed issue where 'fast' should filter can make documents that didn't match the must or must_not clause a match again. Relates to #2979 2013-05-03 17:37:41 +02:00
Alexander Reelsen 70355f693f Refactoring SpanMultiTermQuery support
* Added license headers where needed
* Refactored SpanMultiTermQueryParser
* Refactored tests to adhere to other tests
2013-05-03 16:00:51 +02:00
Anton Hägerstrand e30aa6b221 Support SpanMultiTerm, closes #2610, #2400
This adds support for lucene span multi term queries. This lucene query
allows users to form complicated queries such as wildcards or prefix
queries embedded within span queries.
2013-05-03 16:00:31 +02:00
Igor Motov ed289dc6c7 Improve stability of SimpleDataNodesTests
Make sure that we are waiting for the new state to be propagated to the node where we are executing the followup query that depends on this state.
2013-05-03 09:14:09 -04:00
Simon Willnauer c9c10273a6 Introduced a Opertaion enum that is passed to each call of
WeightFunction#weight to allow dedicated weight calculations per operation. In certain
circumstance it is more efficient / required to ignore certain factors in the weight
calculation to prevent for instance relocations if they are solely triggered by tie-breakers.
In particular the primary balance property should not be taken into account if the delta for
early termination is calculated since otherwise a relocation could be triggered solely by the
fact that two nodes have different amount of primaries allocated to them.

Closes #2984
2013-05-03 14:37:47 +02:00
Alexander Reelsen ad92d82680 Added a first small set of hamcrest matchers
A first implementation of adding matchers and helper methods to elasticsearch.
The following ones are supported

assertHitCount(searchResponse, 2);

// helper methods to easily access the first hits
assertFirstHit(searchResponse, hasId("foo")):
assertSecondHit(searchResponse, hasType("foo")):
assertThirdHit(searchResponse, hasIndex("foo")):

// methods to access all other hits
assertSearchHit(searchResponse, 5, hasId("10"));
// same as above, but maybe more readable
assertSearchHit(searchResponse.getHits().getAt(5), hasIndex("foo"));

I changed GeoFilterTests to show how it works.

Furthermore I inlined assertHighlight() from HighlighterSearchTests.
The ElasticsearchAssertions class can be used now as a centralized assertion class
in order have a centralized class for every developer to look at.
2013-05-03 09:29:56 +02:00
Simon Willnauer 345b63e2d0 Use less agressive threshold to prevent primary relocation in recovery test 2013-05-02 17:51:21 +02:00
Simon Willnauer 72982d955a Use current settings as default in BalancedShardsAllocator instead of defaults.
Custom settings are not always present in the `Settings` that are passed
to `NodeSettingsService.Listener#onRefreshSettings` such that using the defaults
will necessarily override the custom settings if set before.

Closes #2973
2013-05-02 16:23:48 +02:00