Commit Graph

7129 Commits

Author SHA1 Message Date
Tanguy Leroux ce63590bd6 API: Add response filtering with filter_path parameter
This change adds a new "filter_path" parameter that can be used to filter and reduce the responses returned by the REST API of elasticsearch.

For example, returning only the shards that failed to be optimized:
```
curl -XPOST 'localhost:9200/beer/_optimize?filter_path=_shards.failed'
{"_shards":{"failed":0}}%
```

It supports multiple filters (separated by a comma):
```
curl -XGET 'localhost:9200/_mapping?pretty&filter_path=*.mappings.*.properties.name,*.mappings.*.properties.title'
```

It also supports the YAML response format. Here it returns only the `_id` field of a newly indexed document:
```
curl -XPOST 'localhost:9200/library/book?filter_path=_id' -d '---hello:\n  world: 1\n'
---
_id: "AU0j64-b-stVfkvus5-A"
```

It also supports wildcards. Here it returns only the host name of every nodes in the cluster:
```
curl -XGET 'http://localhost:9200/_nodes/stats?filter_path=nodes.*.host*'
{"nodes":{"lvJHed8uQQu4brS-SXKsNA":{"host":"portable"}}}
```

And "**" can be used to include sub fields without knowing the exact path. Here it returns only the Lucene version of every segment:
```
curl 'http://localhost:9200/_segments?pretty&filter_path=indices.**.version'
{
  "indices" : {
    "beer" : {
      "shards" : {
        "0" : [ {
          "segments" : {
            "_0" : {
              "version" : "5.2.0"
            },
            "_1" : {
              "version" : "5.2.0"
            }
          }
        } ]
      }
    }
  }
}
```

Note that elasticsearch sometimes returns directly the raw value of a field, like the _source field. If you want to filter _source fields, you should consider combining the already existing _source parameter (see Get API for more details) with the filter_path parameter like this:

```
curl -XGET 'localhost:9200/_search?pretty&filter_path=hits.hits._source&_source=title'
{
  "hits" : {
    "hits" : [ {
      "_source":{"title":"Book #2"}
    }, {
      "_source":{"title":"Book #1"}
    }, {
      "_source":{"title":"Book #3"}
    } ]
  }
}
```
2015-05-26 13:51:04 +02:00
javanna 543f572d80 Highlighting: keep track of the original query only in HighlighterContext
We used to keep track of the rewritten query in the highlighter context to support custom rewriting done by our own postings highlighter fork. Now that we rely on lucene implementation, no rewrite happens, we can simply keep track of the original query and simplify code around it.

Closes #11317
2015-05-26 12:45:22 +02:00
Britta Weber 802b7b88fa [TEST] fix epected error message 2015-05-26 11:49:33 +02:00
Britta Weber 7c6869d875 Merge pull request #11303 from brwe/custom_analyzer_name
analyzers: custom analyzers names and aliases must not start with _
2015-05-26 11:44:10 +02:00
Britta Weber eeeb29f900 spell correct and add single quotes 2015-05-26 11:41:19 +02:00
Britta Weber 37782c1745 analyzers: custom analyzers names and aliases must not start with _
closes #9596
2015-05-26 11:38:15 +02:00
Michael McCandless 4334404a20 Don't truncate TopDocs after rescoring
We were previously over-trimming the TopDocs such that you get
size-from hits instead of size, which is wrong when from != 0.

Closes #11127

Closes #11342
2015-05-26 04:43:18 -04:00
Michael McCandless 8958096754 don't truncate TopDocs after rescoring 2015-05-26 04:06:21 -04:00
Britta Weber e97353e84a [TEST] don't check shard operations counter in ExceptionRetryTests 2015-05-26 09:00:16 +02:00
Igor Motov f0c18eb704 Snapshot/Restore: check that reading indices is allowed before creating their snapshots
Clean up of Snapshot/Restore cluster and index block handling.

Closes #11133
2015-05-25 18:21:41 -10:00
Simon Willnauer 430be0d7cb [TEST] Skip invalid random file names 2015-05-25 22:41:11 +02:00
Boaz Leskes 20d575d257 Internal: Rename TransportShardReplicationOperationAction to TransportReplicationAction
TransportShardReplicationOperationAction is a mouthful and is the only thing we mean when we say replication.  This commit also changes some related friends.
2015-05-25 22:43:04 +03:00
Michael McCandless 2b57dd7d3e Absorb ImmutableSettings into Settings
Now we have a single (final) Settings implementation.

Closes #11321
2015-05-25 13:14:01 -04:00
Tanguy Leroux 862cec5634 Packaging: Use of default CONF_DIR/CONF_FILE in plugin install
The bin/plugin script now uses the default CONF_DIR & CONF_FILE environment vars. This allows to install a plugin even if Elasticsearch has been installed with a RPM or a DEB package. This commit also adds testing files for TAR archive and plugins installation.

Closes #10673
2015-05-25 13:44:42 +02:00
Robert Muir 38496c8265 remove duplicate test logging configuration 2015-05-22 23:55:27 -04:00
Robert Muir 5330e3423f remove build duplication 2015-05-22 23:23:59 -04:00
Robert Muir 6a32af1990 make some sec mgr / bootup classes package private and final.
These don't need to be accessible except by bootstrap.
2015-05-22 16:45:48 -04:00
jaymode fd7d6caba7 only load a plugin once from the classpath
Today, when loading plugins from the classpath we take the enumeration
given to us by the classloader and attempt to load every URL. This can
cause issues as certain classloaders, such as groovy's, will return the same
URL multiple times in the enumeration. When this happens, startup can fail
with guice errors as bindings have already been registered.

To workaround this, we create a set from the URLs returned by the classloader
to provide uniqueness.
2015-05-22 15:18:22 -04:00
Simon Willnauer d33f0e2527 Add basic javadocs to TransportNodesListGatewayStartedShards 2015-05-22 21:14:45 +02:00
Jack Conradson f47d993715 Search: Refactor of MultiValueMode removing apply and reduce
Simplification of MultiValueMode by removing the apply and reduce
methods for each mode. This creates a more consistent environment for
sorting methods since all sorting must now go through select methods.
This allows for better error handling and better encapsulation for
sorting fields with multiple values.

Note that apply and reduce had inconsistencies in the code base
prior to this change since different calls were assuming that the
accumulator for apply was the first input versus the second input.

Also added is an UnsortedNumericDoubleValues interface to allow
customized values to be input into the different sort modes. This
prevents the need for apply/reduce outside of MultiValueMode.

closes #11290
2015-05-22 10:10:58 -07:00
Alexander Reelsen 85720d8a1c Logging: Add logging for failed TTL purges
In order to get some information if the TTL purger thread could
successfully delete all documents per bulk exection, this commit
adds some logging. TRACE level logging will potentially contain
a lot of information about all the bulk failures.

Closes #11019
2015-05-22 17:40:02 +02:00
markharwood 8c3500a676 Aggregation fix: Sampler agg could not be used with Terms agg’s order.
The Sampler agg was not capable of collecting samples for more than one parent bucket.
Added a Junit test case and changed BestDocsDeferringCollector to internally maintain collections per parent bucket.

Closes #10719
2015-05-22 14:25:41 +01:00
Adrien Grand 35f4e7cc53 Fix compilation: FieldMapper is not longer generic. 2015-05-22 14:23:20 +02:00
Adrien Grand 42f9053817 Merge pull request #11280 from jpountz/fix/remove_binary_compress
Mappings: Remove the `compress`/`compress_threshold` options of the BinaryFieldMapper.
2015-05-22 14:21:13 +02:00
Adrien Grand 461683ac58 Mappings: Remove the `compress`/`compress_threshold` options of the BinaryFieldMapper.
This option is broken currently since it potentially interprets an incoming
binary value as compressed while it just happens that the first bytes are the
same as the LZF header.
2015-05-22 14:20:42 +02:00
Simon Willnauer 5cce09b32d [TEST] Use async durability in load tests 2015-05-22 14:06:24 +02:00
Simon Willnauer 4e1fa3c3b4 [TEST] Provide random instance to rarely(Random) instead of using the threadlocal one 2015-05-22 13:49:01 +02:00
Shay Banon 08e87bd81e Async Fetch: Better logging classification + log when ignored 2015-05-22 11:59:44 +02:00
javanna afb7aabea7 Internal: replace if with existing MetaData#isAllTypes call in MapperService 2015-05-22 11:28:29 +02:00
Simon Willnauer ada98ba0c4 Allow disabling of sigar via settings
Sigar can only be disabled by removing the binaries. This is tricky for our
tests and might cause a lot of trouble if a user wants or needs to do it.
This commit allows to disable sigar with a simple boolean flag in the settings.

Closes #9582
2015-05-22 10:07:40 +02:00
Ryan Ernst 49e965fab0 Mappings: Remove generics from FieldMapper
FieldMapper is currently generic, where the templated type
is only used as the return of a single function, value(Object).
This change simply removes this generic type. It is not needed. The
implementations of value() now has a covariant return (so
those methods have not changed).
2015-05-21 16:07:07 -07:00
Ryan Ernst f071c01afc Add back accidentally removed support for _all as a type alias.
See 4dd4f48
2015-05-21 13:11:32 -07:00
Simon Willnauer cbead88273 Check engine reference for null before flushing
If we close the shard before the engine is started we see a NPE in
the logs which is not problematic since the relevant parts are in a
finally block. Yet, the NPE is unnecessary and can be confusing.
2015-05-21 21:30:35 +02:00
Igor Motov 581bfc74c6 Tests: disable rebalancing in restoreIndexWithShardsMissingInLocalGateway
Rebalancing sometimes kicks in at the end of restore and interferes with reuse stats that this test relies on.
2015-05-21 13:37:06 -04:00
Shay Banon d3e36d0940 [TEST] snapshot test shoudl use assertBusy to provide more info when failing 2015-05-21 19:26:46 +02:00
jaymode 8060cd0794 add profile name to TransportChannel
Today, only the NettyTransportChannel implements the getProfileName method
and the other channel implementations do not. The profile name is useful for some
plugins to perform custom actions based on the name. Rather than checking the
type of the channel, it makes sense to always expose the profile name.

For DirectResponseChannels we use a name that cannot be used in the settings
to define another profile with that name. For LocalTransportChannel we use the
same name as the default profile.

Closes #10483
2015-05-21 12:16:04 -04:00
Adrien Grand 6b3918a97c Clean up and make the test work. 2015-05-21 18:11:17 +02:00
Simon Willnauer c8f39dd2b9 Use ReleaseableLock and try to add a test for it.. 2015-05-21 18:11:17 +02:00
Adrien Grand a98d78b3ae Mappings: Make mapping updates atomic wrt document parsing.
When mapping updates happen concurrently with document parsing, bad things can
happen. For instance, when applying a mapping update we first update the Mapping
object which is used for parsing and then FieldNameAnalyzer which is used by
IndexWriter for analysis. So if you are unlucky, it could happen that a document
was parsed successfully without introducing dynamic updates yet IndexWriter does
not see its analyzer yet.

In order to fix this issue, mapping updates are now protected by a write lock
and document parsing is protected by the read lock associated with this write
lock. This ensures that no documents will be parsed while a mapping update is
being applied, so document parsing will either see none of the update or all of
it.
2015-05-21 18:11:17 +02:00
Simon Willnauer 6b63ea49c2 [TEST] now that we check early if we are corrupted this can be run with many nodes 2015-05-21 17:57:49 +02:00
Simon Willnauer 65c646b01d Also log the shard state info for the shard that can't be opened 2015-05-21 16:46:49 +02:00
Colin Goodheart-Smithe 35deb7efea Aggregations: Renaming reducers to Pipeline Aggregators 2015-05-21 14:57:23 +01:00
javanna e7958f46dc Transport: remove support for reading/writing list of strings, use arrays instead
We recently introduced support for reading and writing list of strings as part of #11056, but that was an oversight, we should be using arrays instead.

Closes #11276
2015-05-21 14:48:20 +02:00
javanna 5a0c456ac2 Internal: Uid#createTypeUids to accept a collection of ids rather than a list, plus rename method variants to avoid clashes
The downside of having createTypeUids accept a list only is that if you do provide a collection nothing breaks at compile time, but you end up calling the same method that accepts an object as second argument. Renamed both methods to avoid clashes to `createUidsForTypesAndId` and `createUidsForTypesAndIds`. The latter accepts now a Collection of Objects rather than just a List.

Closes #11263
2015-05-21 10:41:54 +02:00
Simon Willnauer e91bf8a267 [TEST] Remove corrupted index before checkindex goes wild 2015-05-21 10:21:11 +02:00
Simon Willnauer 4cb21d02a4 Check if the index can be opened and is not corrupted on state listing
We fetch the state version to find the right shard to be started as
the primary. This can return a valid shard state even if the shard is
corrupted and can't even be opened. This commit adds best effort detection
for this scenario and returns an invalid version for the shard if it's corrupted

Closes #11226
2015-05-21 09:52:39 +02:00
Ryan Ernst ea3c5d5820 Merge pull request #11272 from rjernst/refactor/mapper-names
Mappings: Cleanup names handling
2015-05-21 00:36:14 -07:00
Britta Weber 17eec9ddca Merge pull request #11266 from brwe/npe-commitstats
fix NPE when streaming commit stats
2015-05-21 08:51:22 +02:00
Igor Motov dd41c68741 Snapshot/Restore: fix FSRepository location configuration
Closes #11068
2015-05-20 22:14:31 -04:00
Yannick Welsch 14c1743f30 Snapshot/Restore: Batching of snapshot state updates
Similar to the batching of "shards-started" actions, this commit implements batching of snapshot status updates. This is useful when backing up many indices as the cluster state does not need to be republished as many times.

Closes #10295
2015-05-20 20:43:02 -04:00