From cb0003ff6c4fab8fe3518f2bb324950db62380ba Mon Sep 17 00:00:00 2001 From: Jason Veatch Date: Thu, 1 Oct 2015 15:21:34 -0400 Subject: [PATCH 1/4] Clarify that aliases and indices can't share names --- docs/reference/indices/aliases.asciidoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/reference/indices/aliases.asciidoc b/docs/reference/indices/aliases.asciidoc index 7312de48c5c..9a65c89837d 100644 --- a/docs/reference/indices/aliases.asciidoc +++ b/docs/reference/indices/aliases.asciidoc @@ -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`: From 5f1b867158b134aa26d3a3f7def1a82fbacef1c4 Mon Sep 17 00:00:00 2001 From: Clinton Gormley Date: Fri, 2 Oct 2015 16:43:53 +0200 Subject: [PATCH 2/4] Update get-settings.asciidoc Fixed docs for filtering index settings in get-settings API Closes #13872 --- docs/reference/indices/get-settings.asciidoc | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/docs/reference/indices/get-settings.asciidoc b/docs/reference/indices/get-settings.asciidoc index a5950c2ee4b..4689c448b56 100644 --- a/docs/reference/indices/get-settings.asciidoc +++ b/docs/reference/indices/get-settings.asciidoc @@ -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-`. From a5f9cd98d8f0bc2086960c1dfe084c22bc2117e4 Mon Sep 17 00:00:00 2001 From: Jason Tedor Date: Fri, 2 Oct 2015 17:42:40 +0200 Subject: [PATCH 3/4] Remove and forbid use of com.google.common.o.Resources This commit removes and now forbids all uses of com.google.common.io.Resources across the codebase. This is one of the few remaining steps in the eventual removal of Guava as a dependency. Relates #13224 --- .../search/suggest/SuggestSearchIT.java | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/core/src/test/java/org/elasticsearch/search/suggest/SuggestSearchIT.java b/core/src/test/java/org/elasticsearch/search/suggest/SuggestSearchIT.java index e55a736a1de..85993fdf812 100644 --- a/core/src/test/java/org/elasticsearch/search/suggest/SuggestSearchIT.java +++ b/core/src/test/java/org/elasticsearch/search/suggest/SuggestSearchIT.java @@ -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(); @@ -597,7 +599,11 @@ public class SuggestSearchIT extends ESIntegTestCase { // Check the name this time because we're repeating it which is funky 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 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(); From 8434c79429410864d4cb4a590587467e178969f2 Mon Sep 17 00:00:00 2001 From: xuzha Date: Fri, 2 Oct 2015 00:30:39 -0700 Subject: [PATCH 4/4] Update `cat allocation` doc --- docs/reference/cat/allocation.asciidoc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/reference/cat/allocation.asciidoc b/docs/reference/cat/allocation.asciidoc index 6fbdd9d43cc..4c354a814d9 100644 --- a/docs/reference/cat/allocation.asciidoc +++ b/docs/reference/cat/allocation.asciidoc @@ -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