Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
a05fd19c6c
|
@ -19,14 +19,13 @@
|
|||
|
||||
package org.elasticsearch.search.suggest;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import com.google.common.io.Resources;
|
||||
import org.elasticsearch.ElasticsearchException;
|
||||
import org.elasticsearch.action.admin.indices.create.CreateIndexRequestBuilder;
|
||||
import org.elasticsearch.action.index.IndexRequestBuilder;
|
||||
import org.elasticsearch.action.search.*;
|
||||
import org.elasticsearch.action.suggest.SuggestRequestBuilder;
|
||||
import org.elasticsearch.action.suggest.SuggestResponse;
|
||||
import org.elasticsearch.common.io.PathUtils;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.common.xcontent.XContentFactory;
|
||||
import org.elasticsearch.search.suggest.SuggestBuilder.SuggestionBuilder;
|
||||
|
@ -38,6 +37,9 @@ import org.elasticsearch.test.hamcrest.ElasticsearchAssertions;
|
|||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URISyntaxException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
|
@ -470,7 +472,7 @@ public class SuggestSearchIT extends ESIntegTestCase {
|
|||
|
||||
@Test
|
||||
@Nightly
|
||||
public void testMarvelHerosPhraseSuggest() throws IOException {
|
||||
public void testMarvelHerosPhraseSuggest() throws IOException, URISyntaxException {
|
||||
CreateIndexRequestBuilder builder = prepareCreate("test").setSettings(settingsBuilder()
|
||||
.put(indexSettings())
|
||||
.put("index.analysis.analyzer.reverse.tokenizer", "standard")
|
||||
|
@ -506,7 +508,7 @@ public class SuggestSearchIT extends ESIntegTestCase {
|
|||
assertAcked(builder.addMapping("type1", mapping));
|
||||
ensureGreen();
|
||||
|
||||
for (String line: Resources.readLines(SuggestSearchIT.class.getResource("/config/names.txt"), StandardCharsets.UTF_8)) {
|
||||
for (String line : readMarvelHeroNames()) {
|
||||
index("test", "type1", line, "body", line, "body_reverse", line, "bigram", line);
|
||||
}
|
||||
refresh();
|
||||
|
@ -598,6 +600,10 @@ public class SuggestSearchIT extends ESIntegTestCase {
|
|||
assertThat(searchSuggest.getSuggestion("simple_phrase").getEntries().get(0).getText().string(), equalTo("Xor the Got-Jewel Xor the Got-Jewel Xor the Got-Jewel"));
|
||||
}
|
||||
|
||||
private List<String> readMarvelHeroNames() throws IOException, URISyntaxException {
|
||||
return Files.readAllLines(PathUtils.get(SuggestSearchIT.class.getResource("/config/names.txt").toURI()), StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSizePararm() throws IOException {
|
||||
CreateIndexRequestBuilder builder = prepareCreate("test").setSettings(settingsBuilder()
|
||||
|
@ -666,7 +672,7 @@ public class SuggestSearchIT extends ESIntegTestCase {
|
|||
|
||||
@Test
|
||||
@Nightly
|
||||
public void testPhraseBoundaryCases() throws IOException {
|
||||
public void testPhraseBoundaryCases() throws IOException, URISyntaxException {
|
||||
CreateIndexRequestBuilder builder = prepareCreate("test").setSettings(settingsBuilder()
|
||||
.put(indexSettings()).put(SETTING_NUMBER_OF_SHARDS, 1) // to get reliable statistics we should put this all into one shard
|
||||
.put("index.analysis.analyzer.body.tokenizer", "standard")
|
||||
|
@ -698,7 +704,7 @@ public class SuggestSearchIT extends ESIntegTestCase {
|
|||
assertAcked(builder.addMapping("type1", mapping));
|
||||
ensureGreen();
|
||||
|
||||
for (String line: Resources.readLines(SuggestSearchIT.class.getResource("/config/names.txt"), StandardCharsets.UTF_8)) {
|
||||
for (String line : readMarvelHeroNames()) {
|
||||
index("test", "type1", line, "body", line, "bigram", line, "ngram", line);
|
||||
}
|
||||
refresh();
|
||||
|
|
|
@ -7,10 +7,10 @@ and how much disk space they are using.
|
|||
[source,sh]
|
||||
--------------------------------------------------
|
||||
% curl '192.168.56.10:9200/_cat/allocation?v'
|
||||
shards diskUsed diskAvail diskRatio ip node
|
||||
1 5.6gb 72.2gb 7.8% 192.168.56.10 Jarella
|
||||
1 5.6gb 72.2gb 7.8% 192.168.56.30 Solarr
|
||||
1 5.5gb 72.3gb 7.6% 192.168.56.20 Adam II
|
||||
shards disk.indices disk.used disk.avail disk.total disk.percent host ip node
|
||||
1 3.1gb 5.6gb 72.2gb 77.8gb 7.8 192.168.56.10 192.168.56.10 Jarella
|
||||
1 3.1gb 5.6gb 72.2gb 77.8gb 7.8 192.168.56.30 192.168.56.30 Solarr
|
||||
1 3.0gb 5.5gb 72.3gb 77.8gb 7.6 192.168.56.20 192.168.56.20 Adam II
|
||||
--------------------------------------------------
|
||||
|
||||
Here we can see that each node has been allocated a single shard and
|
||||
|
|
|
@ -8,7 +8,7 @@ converting the alias name to the actual index name. An alias can also be
|
|||
mapped to more than one index, and when specifying it, the alias will
|
||||
automatically expand to the aliases indices. An alias can also be
|
||||
associated with a filter that will automatically be applied when
|
||||
searching, and routing values.
|
||||
searching, and routing values. An alias cannot have the same name as an index.
|
||||
|
||||
Here is a sample of associating the alias `alias1` with index `test1`:
|
||||
|
||||
|
|
|
@ -28,23 +28,12 @@ curl -XGET 'http://localhost:9200/2013-*/_settings'
|
|||
--------------------------------------------------
|
||||
|
||||
[float]
|
||||
=== Prefix option
|
||||
=== Filtering settings by name
|
||||
|
||||
There is also support for a `prefix` query string option
|
||||
that allows to include only settings matches the specified prefix.
|
||||
The settings that are returned can be filtered with wildcard matching
|
||||
as follows:
|
||||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
curl -XGET 'http://localhost:9200/my-index/_settings?prefix=index.'
|
||||
|
||||
curl -XGET 'http://localhost:9200/_all/_settings?prefix=index.routing.allocation.'
|
||||
|
||||
curl -XGET 'http://localhost:9200/2013-*/_settings?name=index.merge.*'
|
||||
|
||||
curl -XGET 'http://localhost:9200/2013-*/_settings/index.merge.*'
|
||||
curl -XGET 'http://localhost:9200/2013-*/_settings/name=index.number_*'
|
||||
--------------------------------------------------
|
||||
|
||||
The first example returns all index settings the start with `index.` in the index `my-index`,
|
||||
the second example gets all index settings that start with `index.routing.allocation.` for
|
||||
all indices, lastly the third example returns all index settings that start with `index.merge.`
|
||||
in indices that start with `2013-`.
|
||||
|
|
Loading…
Reference in New Issue