Use alternate example data in OpenSearch test cases. (#454)

This commit updates some of the sample test data used in test cases in OpenSearch.

Signed-off-by: Rabi Panda <adnapibar@gmail.com>
This commit is contained in:
Rabi Panda 2021-03-25 08:52:07 -07:00 committed by GitHub
parent 478b725d56
commit 0bdd1293c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
37 changed files with 209 additions and 209 deletions

View File

@ -1730,7 +1730,7 @@ public class IndicesClientIT extends OpenSearchRestHighLevelClientTestCase {
QueryBuilder builder = QueryBuilders
.boolQuery()
.must(QueryBuilders.queryStringQuery("*:*"))
.filter(QueryBuilders.termQuery("user", "kimchy"));
.filter(QueryBuilders.termQuery("user", "foobar"));
ValidateQueryRequest request = new ValidateQueryRequest(index).query(builder);
request.explain(randomBoolean());
ValidateQueryResponse response = execute(request, highLevelClient().indices()::validateQuery,

View File

@ -115,7 +115,7 @@ public class CRUDDocumentationIT extends OpenSearchRestHighLevelClientTestCase {
{
//tag::index-request-map
Map<String, Object> jsonMap = new HashMap<>();
jsonMap.put("user", "kimchy");
jsonMap.put("user", "foobar");
jsonMap.put("postDate", new Date());
jsonMap.put("message", "trying out OpenSearch");
IndexRequest indexRequest = new IndexRequest("posts")
@ -129,7 +129,7 @@ public class CRUDDocumentationIT extends OpenSearchRestHighLevelClientTestCase {
XContentBuilder builder = XContentFactory.jsonBuilder();
builder.startObject();
{
builder.field("user", "kimchy");
builder.field("user", "foobar");
builder.timeField("postDate", new Date());
builder.field("message", "trying out OpenSearch");
}
@ -144,7 +144,7 @@ public class CRUDDocumentationIT extends OpenSearchRestHighLevelClientTestCase {
//tag::index-request-shortcut
IndexRequest indexRequest = new IndexRequest("posts")
.id("1")
.source("user", "kimchy",
.source("user", "foobar",
"postDate", new Date(),
"message", "trying out OpenSearch"); // <1>
//end::index-request-shortcut
@ -156,7 +156,7 @@ public class CRUDDocumentationIT extends OpenSearchRestHighLevelClientTestCase {
IndexRequest request = new IndexRequest("posts"); // <1>
request.id("1"); // <2>
String jsonString = "{" +
"\"user\":\"kimchy\"," +
"\"user\":\"foobar\"," +
"\"postDate\":\"2013-01-30\"," +
"\"message\":\"trying out OpenSearch\"" +
"}";
@ -838,7 +838,7 @@ public class CRUDDocumentationIT extends OpenSearchRestHighLevelClientTestCase {
request.setScript(
new Script(
ScriptType.INLINE, "painless",
"if (ctx._source.user == 'kimchy') {ctx._source.likes++;}",
"if (ctx._source.user == 'foobar') {ctx._source.likes++;}",
Collections.emptyMap())); // <1>
// end::reindex-request-script
HttpHost host = getClusterHosts().get(0);
@ -903,7 +903,7 @@ public class CRUDDocumentationIT extends OpenSearchRestHighLevelClientTestCase {
// These cannot be set with a remote set, so its set here instead for the docs
// tag::reindex-request-query
request.setSourceQuery(new TermQueryBuilder("user", "kimchy")); // <1>
request.setSourceQuery(new TermQueryBuilder("user", "foobar")); // <1>
// end::reindex-request-query
// tag::reindex-request-slices
request.setSlices(2); // <1>
@ -1021,7 +1021,7 @@ public class CRUDDocumentationIT extends OpenSearchRestHighLevelClientTestCase {
request.setConflicts("proceed"); // <1>
// end::update-by-query-request-conflicts
// tag::update-by-query-request-query
request.setQuery(new TermQueryBuilder("user", "kimchy")); // <1>
request.setQuery(new TermQueryBuilder("user", "foobar")); // <1>
// end::update-by-query-request-query
// tag::update-by-query-request-maxDocs
request.setMaxDocs(10); // <1>
@ -1036,7 +1036,7 @@ public class CRUDDocumentationIT extends OpenSearchRestHighLevelClientTestCase {
request.setScript(
new Script(
ScriptType.INLINE, "painless",
"if (ctx._source.user == 'kimchy') {ctx._source.likes++;}",
"if (ctx._source.user == 'foobar') {ctx._source.likes++;}",
Collections.emptyMap())); // <1>
// end::update-by-query-request-script
// tag::update-by-query-request-timeout
@ -1143,7 +1143,7 @@ public class CRUDDocumentationIT extends OpenSearchRestHighLevelClientTestCase {
request.setConflicts("proceed"); // <1>
// end::delete-by-query-request-conflicts
// tag::delete-by-query-request-query
request.setQuery(new TermQueryBuilder("user", "kimchy")); // <1>
request.setQuery(new TermQueryBuilder("user", "foobar")); // <1>
// end::delete-by-query-request-query
// tag::delete-by-query-request-maxDocs
request.setMaxDocs(10); // <1>
@ -1246,7 +1246,7 @@ public class CRUDDocumentationIT extends OpenSearchRestHighLevelClientTestCase {
assertEquals(200, response.getStatusLine().getStatusCode());
IndexRequest indexRequest = new IndexRequest("posts").id("1")
.source("user", "kimchy",
.source("user", "foobar",
"postDate", new Date(),
"message", "trying out OpenSearch");
IndexResponse indexResponse = client.index(indexRequest, RequestOptions.DEFAULT);
@ -1312,7 +1312,7 @@ public class CRUDDocumentationIT extends OpenSearchRestHighLevelClientTestCase {
GetResponse getResponse = client.get(request, RequestOptions.DEFAULT);
Map<String, Object> sourceAsMap = getResponse.getSourceAsMap();
assertEquals(2, sourceAsMap.size());
assertEquals("kimchy", sourceAsMap.get("user"));
assertEquals("foobar", sourceAsMap.get("user"));
assertTrue(sourceAsMap.containsKey("postDate"));
}
{
@ -1419,7 +1419,7 @@ public class CRUDDocumentationIT extends OpenSearchRestHighLevelClientTestCase {
assertEquals(200, response.getStatusLine().getStatusCode());
IndexRequest indexRequest = new IndexRequest("posts").id("1")
.source("user", "kimchy",
.source("user", "foobar",
"postDate", new Date(),
"message", "trying out OpenSearch");
IndexResponse indexResponse = client.index(indexRequest, RequestOptions.DEFAULT);
@ -1462,7 +1462,7 @@ public class CRUDDocumentationIT extends OpenSearchRestHighLevelClientTestCase {
// end::get-source-response
Map<String, Object> expectSource = new HashMap<>();
expectSource.put("user", "kimchy");
expectSource.put("user", "foobar");
expectSource.put("message", "trying out OpenSearch");
assertEquals(expectSource, source);
}
@ -1651,7 +1651,7 @@ public class CRUDDocumentationIT extends OpenSearchRestHighLevelClientTestCase {
.endObject());
CreateIndexResponse authorsResponse = client.indices().create(authorsRequest, RequestOptions.DEFAULT);
assertTrue(authorsResponse.isAcknowledged());
client.index(new IndexRequest("index").id("1").source("user", "kimchy"), RequestOptions.DEFAULT);
client.index(new IndexRequest("index").id("1").source("user", "foobar"), RequestOptions.DEFAULT);
Response refreshResponse = client().performRequest(new Request("POST", "/authors/_refresh"));
assertEquals(200, refreshResponse.getStatusLine().getStatusCode());
@ -1782,8 +1782,8 @@ public class CRUDDocumentationIT extends OpenSearchRestHighLevelClientTestCase {
.endObject());
CreateIndexResponse authorsResponse = client.indices().create(authorsRequest, RequestOptions.DEFAULT);
assertTrue(authorsResponse.isAcknowledged());
client.index(new IndexRequest("index").id("1").source("user", "kimchy"), RequestOptions.DEFAULT);
client.index(new IndexRequest("index").id("2").source("user", "s1monw"), RequestOptions.DEFAULT);
client.index(new IndexRequest("index").id("1").source("user", "foobar"), RequestOptions.DEFAULT);
client.index(new IndexRequest("index").id("2").source("user", "baz"), RequestOptions.DEFAULT);
Response refreshResponse = client().performRequest(new Request("POST", "/authors/_refresh"));
assertEquals(200, refreshResponse.getStatusLine().getStatusCode());

View File

@ -363,7 +363,7 @@ public class IndicesClientDocumentationIT extends OpenSearchRestHighLevelClientT
request = new CreateIndexRequest("twitter5");
// tag::create-index-request-aliases
request.alias(new Alias("twitter_alias").filter(QueryBuilders.termQuery("user", "kimchy"))); // <1>
request.alias(new Alias("twitter_alias").filter(QueryBuilders.termQuery("user", "foobar"))); // <1>
// end::create-index-request-aliases
// tag::create-index-request-timeout
@ -2216,7 +2216,7 @@ public class IndicesClientDocumentationIT extends OpenSearchRestHighLevelClientT
}
// tag::put-template-request-aliases
request.alias(new Alias("twitter_alias").filter(QueryBuilders.termQuery("user", "kimchy"))); // <1>
request.alias(new Alias("twitter_alias").filter(QueryBuilders.termQuery("user", "foobar"))); // <1>
request.alias(new Alias("{index}_alias").searchRouting("xyz")); // <2>
// end::put-template-request-aliases
@ -2763,7 +2763,7 @@ public class IndicesClientDocumentationIT extends OpenSearchRestHighLevelClientT
QueryBuilder builder = QueryBuilders
.boolQuery() // <1>
.must(QueryBuilders.queryStringQuery("*:*"))
.filter(QueryBuilders.termQuery("user", "kimchy"));
.filter(QueryBuilders.termQuery("user", "foobar"));
request.query(builder); // <2>
// end::indices-validate-query-request-query

View File

@ -102,8 +102,8 @@ public class QueryDSLDocumentationTests extends OpenSearchTestCase {
public void testBoosting() {
// tag::boosting
boostingQuery(
termQuery("name","kimchy"), // <1>
termQuery("name","dadoonet")) // <2>
termQuery("name","foobar"), // <1>
termQuery("name","qux")) // <2>
.negativeBoost(0.2f); // <3>
// end::boosting
}
@ -111,14 +111,14 @@ public class QueryDSLDocumentationTests extends OpenSearchTestCase {
public void testCommonTerms() {
// tag::common_terms
commonTermsQuery("name", // <1>
"kimchy"); // <2>
"foobar"); // <2>
// end::common_terms
}
public void testConstantScore() {
// tag::constant_score
constantScoreQuery(
termQuery("name","kimchy")) // <1>
termQuery("name","foobar")) // <1>
.boost(2.0f); // <2>
// end::constant_score
}
@ -126,7 +126,7 @@ public class QueryDSLDocumentationTests extends OpenSearchTestCase {
public void testDisMax() {
// tag::dis_max
disMaxQuery()
.add(termQuery("name", "kimchy")) // <1>
.add(termQuery("name", "foobar")) // <1>
.add(termQuery("name", "opensearch")) // <2>
.boost(1.2f) // <3>
.tieBreaker(0.7f); // <4>
@ -143,7 +143,7 @@ public class QueryDSLDocumentationTests extends OpenSearchTestCase {
// tag::function_score
FilterFunctionBuilder[] functions = {
new FunctionScoreQueryBuilder.FilterFunctionBuilder(
matchQuery("name", "kimchy"), // <1>
matchQuery("name", "foobar"), // <1>
randomFunction()), // <2>
new FunctionScoreQueryBuilder.FilterFunctionBuilder(
exponentialDecayFunction("age", 0L, 1L)) // <3>
@ -156,7 +156,7 @@ public class QueryDSLDocumentationTests extends OpenSearchTestCase {
// tag::fuzzy
fuzzyQuery(
"name", // <1>
"kimchy"); // <2>
"foobar"); // <2>
// end::fuzzy
}
@ -251,7 +251,7 @@ public class QueryDSLDocumentationTests extends OpenSearchTestCase {
// tag::match
matchQuery(
"name", // <1>
"kimchy opensearch"); // <2>
"foobar opensearch"); // <2>
// end::match
}
@ -269,7 +269,7 @@ public class QueryDSLDocumentationTests extends OpenSearchTestCase {
public void testMultiMatch() {
// tag::multi_match
multiMatchQuery(
"kimchy opensearch", // <1>
"foobar opensearch", // <1>
"user", "message"); // <2>
// end::multi_match
}
@ -295,7 +295,7 @@ public class QueryDSLDocumentationTests extends OpenSearchTestCase {
public void testQueryString() {
// tag::query_string
queryStringQuery("+kimchy -opensearch");
queryStringQuery("+foobar -opensearch");
// end::query_string
}
@ -344,7 +344,7 @@ public class QueryDSLDocumentationTests extends OpenSearchTestCase {
public void testSimpleQueryString() {
// tag::simple_query_string
simpleQueryStringQuery("+kimchy -opensearch");
simpleQueryStringQuery("+foobar -opensearch");
// end::simple_query_string
}
@ -361,7 +361,7 @@ public class QueryDSLDocumentationTests extends OpenSearchTestCase {
public void testSpanFirst() {
// tag::span_first
spanFirstQuery(
spanTermQuery("user", "kimchy"), // <1>
spanTermQuery("user", "foobar"), // <1>
3 // <2>
);
// end::span_first
@ -405,7 +405,7 @@ public class QueryDSLDocumentationTests extends OpenSearchTestCase {
// tag::span_term
spanTermQuery(
"user", // <1>
"kimchy"); // <2>
"foobar"); // <2>
// end::span_term
}
@ -423,7 +423,7 @@ public class QueryDSLDocumentationTests extends OpenSearchTestCase {
// tag::term
termQuery(
"name", // <1>
"kimchy"); // <2>
"foobar"); // <2>
// end::term
}
@ -450,7 +450,7 @@ public class QueryDSLDocumentationTests extends OpenSearchTestCase {
public void testWrapper() {
// tag::wrapper
String query = "{\"term\": {\"user\": \"kimchy\"}}"; // <1>
String query = "{\"term\": {\"user\": \"foobar\"}}"; // <1>
wrapperQuery(query);
// end::wrapper
}

View File

@ -161,7 +161,7 @@ public class SearchDocumentationIT extends OpenSearchRestHighLevelClientTestCase
{
// tag::search-source-basics
SearchSourceBuilder sourceBuilder = new SearchSourceBuilder(); // <1>
sourceBuilder.query(QueryBuilders.termQuery("user", "kimchy")); // <2>
sourceBuilder.query(QueryBuilders.termQuery("user", "foobar")); // <2>
sourceBuilder.from(0); // <3>
sourceBuilder.size(5); // <4>
sourceBuilder.timeout(new TimeValue(60, TimeUnit.SECONDS)); // <5>
@ -279,7 +279,7 @@ public class SearchDocumentationIT extends OpenSearchRestHighLevelClientTestCase
RestHighLevelClient client = highLevelClient();
{
// tag::search-query-builder-ctor
MatchQueryBuilder matchQueryBuilder = new MatchQueryBuilder("user", "kimchy"); // <1>
MatchQueryBuilder matchQueryBuilder = new MatchQueryBuilder("user", "foobar"); // <1>
// end::search-query-builder-ctor
// tag::search-query-builder-options
matchQueryBuilder.fuzziness(Fuzziness.AUTO); // <1>
@ -289,7 +289,7 @@ public class SearchDocumentationIT extends OpenSearchRestHighLevelClientTestCase
}
{
// tag::search-query-builders
QueryBuilder matchQueryBuilder = QueryBuilders.matchQuery("user", "kimchy")
QueryBuilder matchQueryBuilder = QueryBuilders.matchQuery("user", "foobar")
.fuzziness(Fuzziness.AUTO)
.prefixLength(3)
.maxExpansions(10);
@ -382,10 +382,10 @@ public class SearchDocumentationIT extends OpenSearchRestHighLevelClientTestCase
RestHighLevelClient client = highLevelClient();
{
BulkRequest request = new BulkRequest();
request.add(new IndexRequest("posts").id("1").source(XContentType.JSON, "user", "kimchy"));
request.add(new IndexRequest("posts").id("2").source(XContentType.JSON, "user", "javanna"));
request.add(new IndexRequest("posts").id("3").source(XContentType.JSON, "user", "tlrx"));
request.add(new IndexRequest("posts").id("4").source(XContentType.JSON, "user", "cbuescher"));
request.add(new IndexRequest("posts").id("1").source(XContentType.JSON, "user", "foobar"));
request.add(new IndexRequest("posts").id("2").source(XContentType.JSON, "user", "quxx"));
request.add(new IndexRequest("posts").id("3").source(XContentType.JSON, "user", "quzz"));
request.add(new IndexRequest("posts").id("4").source(XContentType.JSON, "user", "corge"));
request.setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE);
BulkResponse bulkResponse = client.bulk(request, RequestOptions.DEFAULT);
assertSame(RestStatus.OK, bulkResponse.status());
@ -415,7 +415,7 @@ public class SearchDocumentationIT extends OpenSearchRestHighLevelClientTestCase
// end::search-request-suggestion-get
assertEquals(1, termSuggestion.getEntries().size());
assertEquals(1, termSuggestion.getEntries().get(0).getOptions().size());
assertEquals("kimchy", termSuggestion.getEntries().get(0).getOptions().get(0).getText().string());
assertEquals("foobar", termSuggestion.getEntries().get(0).getOptions().get(0).getText().string());
}
}
}
@ -427,13 +427,13 @@ public class SearchDocumentationIT extends OpenSearchRestHighLevelClientTestCase
BulkRequest request = new BulkRequest();
request.add(new IndexRequest("posts").id("1")
.source(XContentType.JSON, "title", "In which order are my OpenSearch queries executed?", "user",
Arrays.asList("kimchy", "luca"), "innerObject", Collections.singletonMap("key", "value")));
Arrays.asList("foobar", "quxx"), "innerObject", Collections.singletonMap("key", "value")));
request.add(new IndexRequest("posts").id("2")
.source(XContentType.JSON, "title", "Current status and upcoming changes in OpenSearch", "user",
Arrays.asList("kimchy", "christoph"), "innerObject", Collections.singletonMap("key", "value")));
Arrays.asList("foobar", "grault"), "innerObject", Collections.singletonMap("key", "value")));
request.add(new IndexRequest("posts").id("3")
.source(XContentType.JSON, "title", "The Future of Federated Search in OpenSearch", "user",
Arrays.asList("kimchy", "tanguy"), "innerObject", Collections.singletonMap("key", "value")));
Arrays.asList("foobar", "quuz"), "innerObject", Collections.singletonMap("key", "value")));
request.setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE);
BulkResponse bulkResponse = client.bulk(request, RequestOptions.DEFAULT);
assertSame(RestStatus.OK, bulkResponse.status());
@ -454,7 +454,7 @@ public class SearchDocumentationIT extends OpenSearchRestHighLevelClientTestCase
// end::search-request-highlighting
searchSourceBuilder.query(QueryBuilders.boolQuery()
.should(matchQuery("title", "OpenSearch"))
.should(matchQuery("user", "kimchy")));
.should(matchQuery("user", "foobar")));
searchRequest.source(searchSourceBuilder);
SearchResponse searchResponse = client.search(searchRequest, RequestOptions.DEFAULT);
{
@ -477,7 +477,7 @@ public class SearchDocumentationIT extends OpenSearchRestHighLevelClientTestCase
highlight = highlightFields.get("user");
fragments = highlight.fragments();
assertEquals(1, fragments.length);
assertThat(fragments[0].string(), containsString("<em>kimchy</em>"));
assertThat(fragments[0].string(), containsString("<em>foobar</em>"));
}
}
@ -984,7 +984,7 @@ public class SearchDocumentationIT extends OpenSearchRestHighLevelClientTestCase
// tag::explain-request
ExplainRequest request = new ExplainRequest("contributors", "1");
request.query(QueryBuilders.termQuery("user", "tanguy"));
request.query(QueryBuilders.termQuery("user", "quuz"));
// end::explain-request
// tag::explain-request-routing
@ -1028,8 +1028,8 @@ public class SearchDocumentationIT extends OpenSearchRestHighLevelClientTestCase
Map<String, Object> source = getResult.getSource(); // <1>
Map<String, DocumentField> fields = getResult.getFields(); // <2>
// end::get-result
assertThat(source, equalTo(Collections.singletonMap("user", "tanguy")));
assertThat(fields.get("user").getValue(), equalTo("tanguy"));
assertThat(source, equalTo(Collections.singletonMap("user", "quuz")));
assertThat(fields.get("user").getValue(), equalTo("quuz"));
// tag::explain-execute-listener
ActionListener<ExplainResponse> listener = new ActionListener<ExplainResponse>() {
@ -1128,9 +1128,9 @@ public class SearchDocumentationIT extends OpenSearchRestHighLevelClientTestCase
List<RatedDocument> ratedDocs = new ArrayList<>();
ratedDocs.add(new RatedDocument("posts", "1", 1)); // <2>
SearchSourceBuilder searchQuery = new SearchSourceBuilder();
searchQuery.query(QueryBuilders.matchQuery("user", "kimchy"));// <3>
searchQuery.query(QueryBuilders.matchQuery("user", "foobar"));// <3>
RatedRequest ratedRequest = // <4>
new RatedRequest("kimchy_query", ratedDocs, searchQuery);
new RatedRequest("foobar_query", ratedDocs, searchQuery);
List<RatedRequest> ratedRequests = Arrays.asList(ratedRequest);
RankEvalSpec specification =
new RankEvalSpec(ratedRequests, metric); // <5>
@ -1148,8 +1148,8 @@ public class SearchDocumentationIT extends OpenSearchRestHighLevelClientTestCase
Map<String, EvalQueryQuality> partialResults =
response.getPartialResults();
EvalQueryQuality evalQuality =
partialResults.get("kimchy_query"); // <2>
assertEquals("kimchy_query", evalQuality.getId());
partialResults.get("foobar_query"); // <2>
assertEquals("foobar_query", evalQuality.getId());
double qualityLevel = evalQuality.metricScore(); // <3>
assertEquals(1.0 / 3.0, qualityLevel, 0.0);
List<RatedSearchHit> hitsAndRatings = evalQuality.getHitsAndRatings();
@ -1198,12 +1198,12 @@ public class SearchDocumentationIT extends OpenSearchRestHighLevelClientTestCase
MultiSearchRequest request = new MultiSearchRequest(); // <1>
SearchRequest firstSearchRequest = new SearchRequest(); // <2>
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
searchSourceBuilder.query(QueryBuilders.matchQuery("user", "kimchy"));
searchSourceBuilder.query(QueryBuilders.matchQuery("user", "foobar"));
firstSearchRequest.source(searchSourceBuilder);
request.add(firstSearchRequest); // <3>
SearchRequest secondSearchRequest = new SearchRequest(); // <4>
searchSourceBuilder = new SearchSourceBuilder();
searchSourceBuilder.query(QueryBuilders.matchQuery("user", "luca"));
searchSourceBuilder.query(QueryBuilders.matchQuery("user", "quxx"));
secondSearchRequest.source(searchSourceBuilder);
request.add(secondSearchRequest);
// end::multi-search-request-basic
@ -1281,18 +1281,18 @@ public class SearchDocumentationIT extends OpenSearchRestHighLevelClientTestCase
BulkRequest bulkRequest = new BulkRequest();
bulkRequest.add(new IndexRequest("posts").id("1")
.source(XContentType.JSON, "id", 1, "title", "In which order are my OpenSearch queries executed?", "user",
Arrays.asList("kimchy", "luca"), "innerObject", Collections.singletonMap("key", "value")));
Arrays.asList("foobar", "quxx"), "innerObject", Collections.singletonMap("key", "value")));
bulkRequest.add(new IndexRequest("posts").id("2")
.source(XContentType.JSON, "id", 2, "title", "Current status and upcoming changes in OpenSearch", "user",
Arrays.asList("kimchy", "christoph"), "innerObject", Collections.singletonMap("key", "value")));
Arrays.asList("foobar", "grault"), "innerObject", Collections.singletonMap("key", "value")));
bulkRequest.add(new IndexRequest("posts").id("3")
.source(XContentType.JSON, "id", 3, "title", "The Future of Federated Search in OpenSearch", "user",
Arrays.asList("kimchy", "tanguy"), "innerObject", Collections.singletonMap("key", "value")));
Arrays.asList("foobar", "quuz"), "innerObject", Collections.singletonMap("key", "value")));
bulkRequest.add(new IndexRequest("authors").id("1")
.source(XContentType.JSON, "id", 1, "user", "kimchy"));
.source(XContentType.JSON, "id", 1, "user", "foobar"));
bulkRequest.add(new IndexRequest("contributors").id("1")
.source(XContentType.JSON, "id", 1, "user", "tanguy"));
.source(XContentType.JSON, "id", 1, "user", "quuz"));
bulkRequest.setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE);
@ -1326,7 +1326,7 @@ public class SearchDocumentationIT extends OpenSearchRestHighLevelClientTestCase
{
// tag::count-source-basics
SearchSourceBuilder sourceBuilder = new SearchSourceBuilder(); // <1>
sourceBuilder.query(QueryBuilders.termQuery("user", "kimchy")); // <2>
sourceBuilder.query(QueryBuilders.termQuery("user", "foobar")); // <2>
// end::count-source-basics
// tag::count-source-setter
@ -1402,16 +1402,16 @@ public class SearchDocumentationIT extends OpenSearchRestHighLevelClientTestCase
BulkRequest bulkRequest = new BulkRequest();
bulkRequest.add(new IndexRequest("blog").id("1")
.source(XContentType.JSON, "title", "Doubling Down on Open?", "user",
Collections.singletonList("kimchy"), "innerObject", Collections.singletonMap("key", "value")));
Collections.singletonList("foobar"), "innerObject", Collections.singletonMap("key", "value")));
bulkRequest.add(new IndexRequest("blog").id("2")
.source(XContentType.JSON, "title", "Swiftype Joins Forces with Elastic", "user",
Arrays.asList("kimchy", "matt"), "innerObject", Collections.singletonMap("key", "value")));
Arrays.asList("foobar", "matt"), "innerObject", Collections.singletonMap("key", "value")));
bulkRequest.add(new IndexRequest("blog").id("3")
.source(XContentType.JSON, "title", "On Net Neutrality", "user",
Arrays.asList("tyler", "kimchy"), "innerObject", Collections.singletonMap("key", "value")));
Arrays.asList("tyler", "foobar"), "innerObject", Collections.singletonMap("key", "value")));
bulkRequest.add(new IndexRequest("author").id("1")
.source(XContentType.JSON, "user", "kimchy"));
.source(XContentType.JSON, "user", "foobar"));
bulkRequest.setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE);

View File

@ -74,16 +74,16 @@ public class SynonymsAnalysisTests extends OpenSearchTestCase {
IndexSettings idxSettings = IndexSettingsModule.newIndexSettings("index", settings);
indexAnalyzers = createTestAnalysis(idxSettings, settings, new CommonAnalysisPlugin()).indexAnalyzers;
match("synonymAnalyzer", "kimchy is the dude abides", "shay is the elasticsearch man!");
match("synonymAnalyzer_file", "kimchy is the dude abides", "shay is the elasticsearch man!");
match("synonymAnalyzer", "foobar is the dude abides", "fred is the opensearch man!");
match("synonymAnalyzer_file", "foobar is the dude abides", "fred is the opensearch man!");
match("synonymAnalyzerWordnet", "abstain", "abstain refrain desist");
match("synonymAnalyzerWordnet_file", "abstain", "abstain refrain desist");
match("synonymAnalyzerWithsettings", "kimchy", "sha hay");
match("synonymAnalyzerWithStopAfterSynonym", "kimchy is the dude abides , stop", "shay is the elasticsearch man! ,");
match("synonymAnalyzerWithStopBeforeSynonym", "kimchy is the dude abides , stop", "shay is the elasticsearch man! ,");
match("synonymAnalyzerWithStopSynonymAfterSynonym", "kimchy is the dude abides", "shay is the man!");
match("synonymAnalyzerExpand", "kimchy is the dude abides", "kimchy shay is the dude elasticsearch abides man!");
match("synonymAnalyzerExpandWithStopAfterSynonym", "kimchy is the dude abides", "shay is the dude abides man!");
match("synonymAnalyzerWithsettings", "foobar", "fre red");
match("synonymAnalyzerWithStopAfterSynonym", "foobar is the dude abides , stop", "fred is the opensearch man! ,");
match("synonymAnalyzerWithStopBeforeSynonym", "foobar is the dude abides , stop", "fred is the opensearch man! ,");
match("synonymAnalyzerWithStopSynonymAfterSynonym", "foobar is the dude abides", "fred is the man!");
match("synonymAnalyzerExpand", "foobar is the dude abides", "foobar fred is the dude opensearch abides man!");
match("synonymAnalyzerExpandWithStopAfterSynonym", "foobar is the dude abides", "fred is the dude abides man!");
}
@ -92,9 +92,9 @@ public class SynonymsAnalysisTests extends OpenSearchTestCase {
.put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT)
.put("path.home", createTempDir().toString())
.put("index.analysis.filter.synonym.type", "synonym")
.putList("index.analysis.filter.synonym.synonyms", "kimchy => shay", "dude => elasticsearch", "abides => man!")
.putList("index.analysis.filter.synonym.synonyms", "foobar => fred", "dude => opensearch", "abides => man!")
.put("index.analysis.filter.stop_within_synonym.type", "stop")
.putList("index.analysis.filter.stop_within_synonym.stopwords", "kimchy", "elasticsearch")
.putList("index.analysis.filter.stop_within_synonym.stopwords", "foobar", "opensearch")
.put("index.analysis.analyzer.synonymAnalyzerWithStopSynonymBeforeSynonym.tokenizer", "whitespace")
.putList("index.analysis.analyzer.synonymAnalyzerWithStopSynonymBeforeSynonym.filter", "stop_within_synonym","synonym")
.build();
@ -113,9 +113,9 @@ public class SynonymsAnalysisTests extends OpenSearchTestCase {
.put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT)
.put("path.home", createTempDir().toString())
.put("index.analysis.filter.synonym_expand.type", "synonym")
.putList("index.analysis.filter.synonym_expand.synonyms", "kimchy, shay", "dude, elasticsearch", "abides, man!")
.putList("index.analysis.filter.synonym_expand.synonyms", "foobar, fred", "dude, opensearch", "abides, man!")
.put("index.analysis.filter.stop_within_synonym.type", "stop")
.putList("index.analysis.filter.stop_within_synonym.stopwords", "kimchy", "elasticsearch")
.putList("index.analysis.filter.stop_within_synonym.stopwords", "foobar", "opensearch")
.put("index.analysis.analyzer.synonymAnalyzerExpandWithStopBeforeSynonym.tokenizer", "whitespace")
.putList("index.analysis.analyzer.synonymAnalyzerExpandWithStopBeforeSynonym.filter", "stop_within_synonym","synonym_expand")
.build();

View File

@ -54,7 +54,7 @@
"synonym":{
"type":"synonym",
"synonyms":[
"kimchy => shay",
"foobar => fred",
"dude => opensearch",
"abides => man!"
]
@ -80,7 +80,7 @@
"synonymWithTokenizerSettings":{
"type":"synonym",
"synonyms":[
"kimchy => shay"
"foobar => fred"
]
},
"stop":{
@ -89,12 +89,12 @@
},
"stop_within_synonym":{
"type": "stop",
"stopwords":["kimchy", "opensearch"]
"stopwords":["foobar", "opensearch"]
},
"synonym_expand":{
"type":"synonym",
"synonyms":[
"kimchy , shay",
"foobar , fred",
"dude , opensearch",
"abides , man!"
]

View File

@ -1,3 +1,3 @@
kimchy => shay
dude => elasticsearch
foobar => fred
dude => opensearch
abides => man!

View File

@ -68,7 +68,7 @@
filter:
synonym:
type: synonym
synonyms: ["kimchy => shay"]
synonyms: ["foobar => fred"]
- do:
indices.analyze:
@ -76,10 +76,10 @@
body:
tokenizer: trigram
filter: [synonym]
text: kimchy
text: foobar
- length: { tokens: 2 }
- match: { tokens.0.token: sha }
- match: { tokens.1.token: hay }
- match: { tokens.0.token: fre }
- match: { tokens.1.token: red }
---
"Custom normalizer in request":

View File

@ -17,19 +17,19 @@
filter:
synonym:
type: synonym
synonyms: ["<p>kimchy</p> => shay", "dude => <html>opensearch</html>", "<font>abides</font> => man!"]
synonyms: ["<p>foobar</p> => fred", "dude => <html>opensearch</html>", "<font>abides</font> => man!"]
- do:
indices.analyze:
index: test_synonym_with_charfilter
body:
analyzer: "synonymAnalyzerWithCharfilter"
text: "kimchy is the dude <html>abides</html>"
text: "foobar is the dude <html>abides</html>"
- length: { tokens: 5 }
- match: { tokens.0.token: shay }
- match: { tokens.0.token: fred }
- match: { tokens.1.token: is }
- match: { tokens.2.token: the }
- match: { tokens.3.token: elasticsearch }
- match: { tokens.3.token: opensearch }
- match: { tokens.4.token: man! }
---

View File

@ -254,7 +254,7 @@
index:
index: twitter
id: 1
body: { "user": "kimchy" }
body: { "user": "foobar" }
- do:
index:
index: twitter
@ -270,7 +270,7 @@
body:
query:
match:
user: kimchy
user: foobar
- match: {deleted: 1}
- match: {version_conflicts: 0}
- match: {batches: 1}
@ -294,12 +294,12 @@
index:
index: twitter
id: 1
body: { "user": "kimchy" }
body: { "user": "foobar" }
- do:
index:
index: twitter
id: 2
body: { "user": "kimchy" }
body: { "user": "foobar" }
- do:
indices.refresh: {}
@ -339,12 +339,12 @@
index:
index: twitter
id: 1
body: { "user": "kimchy" }
body: { "user": "foobar" }
- do:
index:
index: twitter
id: 2
body: { "user": "kimchy" }
body: { "user": "foobar" }
- do:
indices.refresh: {}
@ -382,12 +382,12 @@
index:
index: twitter
id: 1
body: { "user": "kimchy" }
body: { "user": "foobar" }
- do:
index:
index: twitter
id: 2
body: { "user": "kimchy" }
body: { "user": "foobar" }
- do:
indices.refresh: {}
@ -425,12 +425,12 @@
index:
index: twitter
id: 1
body: { "user": "kimchy" }
body: { "user": "foobar" }
- do:
index:
index: twitter
id: 2
body: { "user": "kimchy" }
body: { "user": "foobar" }
- do:
indices.refresh: {}
@ -441,7 +441,7 @@
max_docs: 1
query:
match:
user: "kimchy"
user: "foobar"
- match: {deleted: 1}
- match: {version_conflicts: 0}

View File

@ -4,7 +4,7 @@
index:
index: twitter
id: 1
body: { "user": "kimchy" }
body: { "user": "foobar" }
- do:
indices.refresh: {}
@ -29,7 +29,7 @@
body:
query:
match:
user: otherkimchy
user: otherfoobar
- match: { hits.total: 1 }
---
@ -38,7 +38,7 @@
index:
index: twitter
id: 1
body: { "user": "kimchy" }
body: { "user": "foobar" }
- do:
index:
index: twitter
@ -68,7 +68,7 @@
body:
query:
match:
user: otherkimchy
user: otherfoobar
- match: { hits.total: 1 }
- do:
@ -87,7 +87,7 @@
index:
index: twitter
id: 1
body: { "user": "kimchy" }
body: { "user": "foobar" }
- do:
index:
index: twitter
@ -114,8 +114,8 @@
get:
index: new_twitter
id: 1
routing: kimchy
- match: { _routing: kimchy }
routing: foobar
- match: { _routing: foobar }
- do:
get:
@ -130,7 +130,7 @@
index:
index: twitter
id: 1
body: { "user": "kimchy" }
body: { "user": "foobar" }
- do:
index:
index: twitter
@ -149,7 +149,7 @@
index: new_twitter
script:
lang: painless
source: if (ctx._source.user == "kimchy") {ctx._source.user = "not" + ctx._source.user} else {ctx.op = "noop"}
source: if (ctx._source.user == "foobar") {ctx._source.user = "not" + ctx._source.user} else {ctx.op = "noop"}
- match: {created: 1}
- match: {noops: 1}
@ -160,7 +160,7 @@
body:
query:
match:
user: notkimchy
user: notfoobar
- match: { hits.total: 1 }
- do:
@ -184,7 +184,7 @@
index:
index: twitter
id: 1
body: { "user": "kimchy" }
body: { "user": "foobar" }
- do:
index:
index: twitter
@ -219,14 +219,14 @@
id: 1
version: 1
version_type: external
body: { "user": "kimchy" }
body: { "user": "foobar" }
- do:
index:
index: new_twitter
id: 1
version: 1
version_type: external
body: { "user": "kimchy" }
body: { "user": "foobar" }
- do:
indices.refresh: {}
@ -252,7 +252,7 @@
body:
query:
match:
user: otherkimchy
user: otherfoobar
- match: { hits.total: 1 }
---
@ -261,12 +261,12 @@
index:
index: twitter
id: 1
body: { "user": "kimchy" }
body: { "user": "foobar" }
- do:
index:
index: new_twitter
id: 1
body: { "user": "kimchy" }
body: { "user": "foobar" }
- do:
indices.refresh: {}
@ -291,7 +291,7 @@
body:
query:
match:
user: otherkimchy
user: otherfoobar
- match: { hits.total: 1 }
---
@ -300,7 +300,7 @@
index:
index: twitter
id: 1
body: { "user": "kimchy" }
body: { "user": "foobar" }
- do:
index:
index: twitter
@ -319,7 +319,7 @@
index: new_twitter
script:
lang: painless
source: if (ctx._source.user == "kimchy") {ctx._index = 'other_new_twitter'}
source: if (ctx._source.user == "foobar") {ctx._index = 'other_new_twitter'}
- match: {created: 2}
- match: {noops: 0}
@ -330,7 +330,7 @@
body:
query:
match:
user: kimchy
user: foobar
- match: { hits.total: 1 }
- do:
@ -423,7 +423,7 @@
index:
index: twitter
id: 1
body: { "user": "kimchy" }
body: { "user": "foobar" }
- do:
indices.refresh: {}

View File

@ -198,7 +198,7 @@
index:
index: twitter
id: 1
body: { "user": "kimchy" }
body: { "user": "foobar" }
- do:
index:
index: twitter
@ -213,7 +213,7 @@
body:
query:
match:
user: kimchy
user: foobar
- match: {updated: 1}
- match: {version_conflicts: 0}
- match: {batches: 1}
@ -231,12 +231,12 @@
index:
index: twitter
id: 1
body: { "user": "kimchy" }
body: { "user": "foobar" }
- do:
index:
index: twitter
id: 2
body: { "user": "kimchy" }
body: { "user": "foobar" }
- do:
indices.refresh: {}
@ -263,12 +263,12 @@
index:
index: twitter
id: 1
body: { "user": "kimchy" }
body: { "user": "foobar" }
- do:
index:
index: twitter
id: 2
body: { "user": "kimchy" }
body: { "user": "foobar" }
- do:
indices.refresh: {}
@ -293,12 +293,12 @@
index:
index: twitter
id: 1
body: { "user": "kimchy" }
body: { "user": "foobar" }
- do:
index:
index: twitter
id: 2
body: { "user": "kimchy" }
body: { "user": "foobar" }
- do:
indices.refresh: {}
@ -323,12 +323,12 @@
index:
index: twitter
id: 1
body: { "user": "kimchy" }
body: { "user": "foobar" }
- do:
index:
index: twitter
id: 2
body: { "user": "kimchy" }
body: { "user": "foobar" }
- do:
indices.refresh: {}
@ -339,7 +339,7 @@
max_docs: 1
query:
match:
user: "kimchy"
user: "foobar"
- match: {updated: 1}
- match: {version_conflicts: 0}
- match: {batches: 1}

View File

@ -4,7 +4,7 @@
index:
index: twitter
id: 1
body: { "user": "kimchy" }
body: { "user": "foobar" }
- do:
indices.refresh: {}
@ -26,7 +26,7 @@
body:
query:
match:
user: notkimchy
user: notfoobar
- match: { hits.total: 1 }
---
@ -35,7 +35,7 @@
index:
index: twitter
id: 1
body: { "user": "kimchy" }
body: { "user": "foobar" }
- do:
indices.refresh: {}
@ -54,7 +54,7 @@
body:
query:
match:
user: notkimchy
user: notfoobar
- match: { hits.total: 1 }
---
@ -63,7 +63,7 @@
index:
index: twitter
id: 1
body: { "user": "kimchy" }
body: { "user": "foobar" }
- do:
index:
index: twitter
@ -79,7 +79,7 @@
body:
script:
lang: painless
source: if (ctx._source.user == "kimchy") {ctx._source.user = "not" + ctx._source.user} else {ctx.op = "noop"}
source: if (ctx._source.user == "foobar") {ctx._source.user = "not" + ctx._source.user} else {ctx.op = "noop"}
- match: {updated: 1}
- match: {noops: 1}
@ -90,7 +90,7 @@
body:
query:
match:
user: notkimchy
user: notfoobar
- match: { hits.total: 1 }
- do:
@ -109,7 +109,7 @@
index:
index: twitter
id: 1
body: { "user": "kimchy" }
body: { "user": "foobar" }
- do:
index:
index: twitter
@ -136,7 +136,7 @@
index:
index: twitter
id: 1
body: { "user": "kimchy" }
body: { "user": "foobar" }
- do:
indices.refresh: {}
@ -155,7 +155,7 @@
index:
index: twitter
id: 1
body: { "user": "kimchy" }
body: { "user": "foobar" }
- do:
indices.refresh: {}
@ -311,7 +311,7 @@
index:
index: twitter
id: 1
body: { "user": "kimchy" }
body: { "user": "foobar" }
- do:
index:
index: twitter
@ -328,7 +328,7 @@
body:
script:
lang: painless
source: if (ctx._source.user == "kimchy") {ctx.op = "index"} else {ctx.op = "junk"}
source: if (ctx._source.user == "foobar") {ctx.op = "index"} else {ctx.op = "junk"}
- match: { error.reason: 'Operation type [junk] not allowed, only [noop, index, delete] are allowed' }
@ -418,7 +418,7 @@
index:
index: twitter
id: 1
body: { "user": "kimchy" }
body: { "user": "foobar" }
- do:
indices.refresh: {}

View File

@ -187,7 +187,7 @@ public class AttachmentProcessorTests extends OpenSearchTestCase {
assertThat(attachmentData.get("language"), is("en"));
assertThat(attachmentData.get("content"), is(notNullValue()));
assertThat(attachmentData.get("content_length"), is(notNullValue()));
assertThat(attachmentData.get("author"), is("kimchy"));
assertThat(attachmentData.get("author"), is("foobar"));
assertThat(attachmentData.get("keywords"), is("opensearch,cool,bonsai"));
assertThat(attachmentData.get("title"), is("Hello"));
assertThat(attachmentData.get("content_type").toString(), containsString("text/html"));

View File

@ -4,7 +4,7 @@
<head>
<title>Hello</title>
<meta name="date" content="">
<meta name="Author" content="kimchy">
<meta name="Author" content="foobar">
<meta name="Keywords" content="opensearch,cool,bonsai">
</head>
<body>Hello again. This is a test sentence to check for language detection.</body>

View File

@ -4,7 +4,7 @@
<head>
<title>Hello</title>
<meta name="date" content="2012-11-30">
<meta name="Author" content="kimchy">
<meta name="Author" content="foobar">
<meta name="Keywords" content="opensearch,cool,bonsai">
</head>
<body>World</body>

View File

@ -3,7 +3,7 @@
<html lang="fr">
<head>
<title>Hello</title>
<meta name="Author" content="kimchy">
<meta name="Author" content="foobar">
<meta name="Keywords" content="opensearch,cool,bonsai">
</head>
<body>World</body>

View File

@ -20,7 +20,7 @@
index: twitter
type: _doc
id: 1
body: { "user": "kimchy" }
body: { "user": "foobar" }
- do:
indices.refresh: {}

View File

@ -20,7 +20,7 @@
index: twitter
type: tweet
id: 1
body: { "user": "kimchy" }
body: { "user": "foobar" }
- do:
indices.refresh: {}

View File

@ -55,7 +55,7 @@
aliases:
test_alias: {}
test_blias: { routing: b }
test_clias: { filter: { term: { user: kimchy }}}
test_clias: { filter: { term: { user: foobar }}}
- do:
indices.get_index_template:
@ -68,7 +68,7 @@
- is_true: index_templates.0.index_template.template.aliases.test_alias
- match: {index_templates.0.index_template.template.aliases.test_blias.index_routing: "b" }
- match: {index_templates.0.index_template.template.aliases.test_blias.search_routing: "b" }
- match: {index_templates.0.index_template.template.aliases.test_clias.filter.term.user: "kimchy" }
- match: {index_templates.0.index_template.template.aliases.test_clias.filter.term.user: "foobar" }
---
"Put index template with 'create' flag":

View File

@ -88,7 +88,7 @@
aliases:
test_alias: {}
test_blias: { routing: b }
test_clias: { filter: { term: { user: kimchy }}}
test_clias: { filter: { term: { user: foobar }}}
- do:
indices.get_template:
@ -99,7 +99,7 @@
- is_true: test.aliases.test_alias
- match: { test.aliases.test_blias.index_routing: "b" }
- match: { test.aliases.test_blias.search_routing: "b" }
- match: { test.aliases.test_clias.filter.term.user: "kimchy" }
- match: { test.aliases.test_clias.filter.term.user: "foobar" }
---
"Put template create":

View File

@ -204,16 +204,16 @@ public class IndexAliasesIT extends OpenSearchIntegTestCase {
ensureGreen();
logger.info("--> aliasing index [test] with [alias1] and filter [user:kimchy]");
QueryBuilder filter = termQuery("user", "kimchy");
logger.info("--> aliasing index [test] with [alias1] and filter [user:foobar]");
QueryBuilder filter = termQuery("user", "foobar");
assertAliasesVersionIncreases("test", () -> assertAcked(admin().indices().prepareAliases().addAlias("test", "alias1", filter)));
// For now just making sure that filter was stored with the alias
logger.info("--> making sure that filter was stored with alias [alias1] and filter [user:kimchy]");
logger.info("--> making sure that filter was stored with alias [alias1] and filter [user:foobar]");
ClusterState clusterState = admin().cluster().prepareState().get().getState();
IndexMetadata indexMd = clusterState.metadata().index("test");
assertThat(indexMd.getAliases().get("alias1").filter().string(),
equalTo("{\"term\":{\"user\":{\"value\":\"kimchy\",\"boost\":1.0}}}"));
equalTo("{\"term\":{\"user\":{\"value\":\"foobar\",\"boost\":1.0}}}"));
}

View File

@ -553,14 +553,14 @@ public class SimpleNestedIT extends OpenSearchIntegTestCase {
+ " \"name\": \"read\",\n"
+ " \"user\": [\n"
+ " {\"username\": \"matt\", \"id\": 1},\n"
+ " {\"username\": \"shay\", \"id\": 2},\n"
+ " {\"username\": \"fred\", \"id\": 2},\n"
+ " {\"username\": \"adrien\", \"id\": 3}\n"
+ " ]\n"
+ " },\n"
+ " {\n"
+ " \"name\": \"write\",\n"
+ " \"user\": [\n"
+ " {\"username\": \"shay\", \"id\": 2},\n"
+ " {\"username\": \"fred\", \"id\": 2},\n"
+ " {\"username\": \"adrien\", \"id\": 3}\n"
+ " ]\n"
+ " }\n"
@ -573,19 +573,19 @@ public class SimpleNestedIT extends OpenSearchIntegTestCase {
+ " \"name\": \"read\",\n"
+ " \"user\": [\n"
+ " {\"username\": \"jim\", \"id\": 4},\n"
+ " {\"username\": \"shay\", \"id\": 2}\n"
+ " {\"username\": \"fred\", \"id\": 2}\n"
+ " ]\n"
+ " },\n"
+ " {\n"
+ " \"name\": \"write\",\n"
+ " \"user\": [\n"
+ " {\"username\": \"shay\", \"id\": 2}\n"
+ " {\"username\": \"fred\", \"id\": 2}\n"
+ " ]\n"
+ " },\n"
+ " {\n"
+ " \"name\": \"execute\",\n"
+ " \"user\": [\n"
+ " {\"username\": \"shay\", \"id\": 2}\n"
+ " {\"username\": \"fred\", \"id\": 2}\n"
+ " ]\n"
+ " }\n"
+ " ]\n"
@ -602,13 +602,13 @@ public class SimpleNestedIT extends OpenSearchIntegTestCase {
+ " \"name\": \"read\",\n"
+ " \"user\": [\n"
+ " {\"username\": \"matt\", \"id\": 1},\n"
+ " {\"username\": \"luca\", \"id\": 5}\n"
+ " {\"username\": \"quxx\", \"id\": 5}\n"
+ " ]\n"
+ " },\n"
+ " {\n"
+ " \"name\": \"execute\",\n"
+ " \"user\": [\n"
+ " {\"username\": \"luca\", \"id\": 5}\n"
+ " {\"username\": \"quxx\", \"id\": 5}\n"
+ " ]\n"
+ " }\n"
+ " ]\n"
@ -640,7 +640,7 @@ public class SimpleNestedIT extends OpenSearchIntegTestCase {
+ "}", XContentType.JSON).get();
refresh();
// access id = 1, read, max value, asc, should use matt and shay
// access id = 1, read, max value, asc, should use matt and fred
SearchResponse searchResponse = client().prepareSearch()
.setQuery(matchAllQuery())
.addSort(
@ -660,10 +660,10 @@ public class SimpleNestedIT extends OpenSearchIntegTestCase {
assertThat(searchResponse.getHits().getHits()[0].getId(), equalTo("2"));
assertThat(searchResponse.getHits().getHits()[0].getSortValues()[0].toString(), equalTo("matt"));
assertThat(searchResponse.getHits().getHits()[1].getId(), equalTo("1"));
assertThat(searchResponse.getHits().getHits()[1].getSortValues()[0].toString(), equalTo("shay"));
assertThat(searchResponse.getHits().getHits()[1].getSortValues()[0].toString(), equalTo("fred"));
// access id = 1, read, min value, asc, should now use adrien and luca
// access id = 1, read, min value, asc, should now use adrien and quxx
searchResponse = client().prepareSearch()
.setQuery(matchAllQuery())
.addSort(
@ -683,9 +683,9 @@ public class SimpleNestedIT extends OpenSearchIntegTestCase {
assertThat(searchResponse.getHits().getHits()[0].getId(), equalTo("1"));
assertThat(searchResponse.getHits().getHits()[0].getSortValues()[0].toString(), equalTo("adrien"));
assertThat(searchResponse.getHits().getHits()[1].getId(), equalTo("2"));
assertThat(searchResponse.getHits().getHits()[1].getSortValues()[0].toString(), equalTo("luca"));
assertThat(searchResponse.getHits().getHits()[1].getSortValues()[0].toString(), equalTo("quxx"));
// execute, by matt or luca, by user id, sort missing first
// execute, by matt or quxx, by user id, sort missing first
searchResponse = client().prepareSearch()
.setQuery(matchAllQuery())
.addSort(
@ -694,7 +694,7 @@ public class SimpleNestedIT extends OpenSearchIntegTestCase {
.setNestedSort(new NestedSortBuilder("acl.operation")
.setFilter(QueryBuilders.termQuery("acl.operation.name", "execute"))
.setNestedSort(new NestedSortBuilder("acl.operation.user")
.setFilter(QueryBuilders.termsQuery("acl.operation.user.username", "matt", "luca")))))
.setFilter(QueryBuilders.termsQuery("acl.operation.user.username", "matt", "quxx")))))
.missing("_first")
.sortMode(SortMode.MIN)
.order(SortOrder.DESC)
@ -716,7 +716,7 @@ public class SimpleNestedIT extends OpenSearchIntegTestCase {
.setNestedSort(new NestedSortBuilder("acl.operation")
.setFilter(QueryBuilders.termQuery("acl.operation.name", "execute"))
.setNestedSort(new NestedSortBuilder("acl.operation.user")
.setFilter(QueryBuilders.termsQuery("acl.operation.user.username", "matt", "luca")))))
.setFilter(QueryBuilders.termsQuery("acl.operation.user.username", "matt", "quxx")))))
.sortMode(SortMode.MIN)
.order(SortOrder.DESC)
)
@ -725,7 +725,7 @@ public class SimpleNestedIT extends OpenSearchIntegTestCase {
assertHitCount(searchResponse, 2);
assertThat(searchResponse.getHits().getHits().length, equalTo(2));
assertThat(searchResponse.getHits().getHits()[0].getId(), equalTo("2"));
assertThat(searchResponse.getHits().getHits()[0].getSortValues()[0].toString(), equalTo("luca"));
assertThat(searchResponse.getHits().getHits()[0].getSortValues()[0].toString(), equalTo("quxx"));
assertThat(searchResponse.getHits().getHits()[1].getId(), equalTo("1")); // missing last
}

View File

@ -920,8 +920,8 @@ public class SearchQueryIT extends OpenSearchIntegTestCase {
public void testFuzzyQueryString() {
createIndex("test");
client().prepareIndex("test", "type1", "1").setSource("str", "kimchy", "date", "2012-02-01", "num", 12).get();
client().prepareIndex("test", "type1", "2").setSource("str", "shay", "date", "2012-02-05", "num", 20).get();
client().prepareIndex("test", "type1", "1").setSource("str", "foobar", "date", "2012-02-01", "num", 12).get();
client().prepareIndex("test", "type1", "2").setSource("str", "fred", "date", "2012-02-05", "num", 20).get();
refresh();
SearchResponse searchResponse = client().prepareSearch().setQuery(queryStringQuery("str:kimcy~1")).get();
@ -951,8 +951,8 @@ public class SearchQueryIT extends OpenSearchIntegTestCase {
public void testSpecialRangeSyntaxInQueryString() {
createIndex("test");
client().prepareIndex("test", "type1", "1").setSource("str", "kimchy", "date", "2012-02-01", "num", 12).get();
client().prepareIndex("test", "type1", "2").setSource("str", "shay", "date", "2012-02-05", "num", 20).get();
client().prepareIndex("test", "type1", "1").setSource("str", "foobar", "date", "2012-02-01", "num", 12).get();
client().prepareIndex("test", "type1", "2").setSource("str", "fred", "date", "2012-02-05", "num", 20).get();
refresh();
SearchResponse searchResponse = client().prepareSearch().setQuery(queryStringQuery("num:>19")).get();

View File

@ -213,7 +213,7 @@ public class SearchScrollIT extends OpenSearchIntegTestCase {
for (int i = 0; i < 500; i++) {
client().prepareIndex("test", "tweet", Integer.toString(i)).setSource(
jsonBuilder().startObject().field("user", "kimchy").field("postDate", System.currentTimeMillis())
jsonBuilder().startObject().field("user", "foobar").field("postDate", System.currentTimeMillis())
.field("message", "test").endObject()).get();
}
@ -230,7 +230,7 @@ public class SearchScrollIT extends OpenSearchIntegTestCase {
equalTo(0L));
SearchResponse searchResponse = client().prepareSearch()
.setQuery(queryStringQuery("user:kimchy"))
.setQuery(queryStringQuery("user:foobar"))
.setSize(35)
.setScroll(TimeValue.timeValueMinutes(2))
.addSort("postDate", SortOrder.ASC)

View File

@ -269,7 +269,7 @@ public class SimpleValidateQueryIT extends OpenSearchIntegTestCase {
refresh();
assertThat(client().admin().indices().prepareValidateQuery("test").setQuery(QueryBuilders.wrapperQuery(
new BytesArray("{\"foo\": \"bar\", \"query\": {\"term\" : { \"user\" : \"kimchy\" }}}"))).get().isValid(), equalTo(false));
new BytesArray("{\"foo\": \"bar\", \"query\": {\"term\" : { \"user\" : \"foobar\" }}}"))).get().isValid(), equalTo(false));
}
public void testIrrelevantPropertiesAfterQuery() throws IOException {
@ -278,7 +278,7 @@ public class SimpleValidateQueryIT extends OpenSearchIntegTestCase {
refresh();
assertThat(client().admin().indices().prepareValidateQuery("test").setQuery(QueryBuilders.wrapperQuery(
new BytesArray("{\"query\": {\"term\" : { \"user\" : \"kimchy\" }}, \"foo\": \"bar\"}"))).get().isValid(), equalTo(false));
new BytesArray("{\"query\": {\"term\" : { \"user\" : \"foobar\" }}, \"foo\": \"bar\"}"))).get().isValid(), equalTo(false));
}
private static void assertExplanation(QueryBuilder queryBuilder, Matcher<String> matcher, boolean withRewrite) {

View File

@ -72,7 +72,7 @@ public class ToAndFromJsonMetadataTests extends OpenSearchTestCase {
.put("setting1", "value1")
.put("setting2", "value2"))
.putAlias(newAliasMetadataBuilder("alias-bar1"))
.putAlias(newAliasMetadataBuilder("alias-bar2").filter("{\"term\":{\"user\":\"kimchy\"}}"))
.putAlias(newAliasMetadataBuilder("alias-bar2").filter("{\"term\":{\"user\":\"foobar\"}}"))
.putAlias(newAliasMetadataBuilder("alias-bar3").routing("routing-bar")))
.put("component_template", new ComponentTemplate(
new Template(Settings.builder().put("setting", "value").build(),
@ -107,7 +107,7 @@ public class ToAndFromJsonMetadataTests extends OpenSearchTestCase {
.put("setting1", "value1")
.put("setting2", "value2"))
.putAlias(newAliasMetadataBuilder("alias-bar1"))
.putAlias(newAliasMetadataBuilder("alias-bar2").filter("{\"term\":{\"user\":\"kimchy\"}}"))
.putAlias(newAliasMetadataBuilder("alias-bar2").filter("{\"term\":{\"user\":\"foobar\"}}"))
.putAlias(newAliasMetadataBuilder("alias-bar3").routing("routing-bar")))
.put(idx1, false)
.put(idx2, false)
@ -133,7 +133,7 @@ public class ToAndFromJsonMetadataTests extends OpenSearchTestCase {
assertThat(parsedMetadata.templates().get("foo").aliases().get("alias-bar1").alias(), equalTo("alias-bar1"));
assertThat(parsedMetadata.templates().get("foo").aliases().get("alias-bar2").alias(), equalTo("alias-bar2"));
assertThat(parsedMetadata.templates().get("foo").aliases().get("alias-bar2").filter().string(),
equalTo("{\"term\":{\"user\":\"kimchy\"}}"));
equalTo("{\"term\":{\"user\":\"foobar\"}}"));
assertThat(parsedMetadata.templates().get("foo").aliases().get("alias-bar3").alias(), equalTo("alias-bar3"));
assertThat(parsedMetadata.templates().get("foo").aliases().get("alias-bar3").indexRouting(), equalTo("routing-bar"));
assertThat(parsedMetadata.templates().get("foo").aliases().get("alias-bar3").searchRouting(), equalTo("routing-bar"));

View File

@ -997,13 +997,13 @@ public class DocumentParserTests extends MapperServiceTestCase {
Document doc = docMapper.parse(source(b -> {
b.startObject("name");
{
b.field("first", "shay");
b.field("last", "banon");
b.field("first", "fred");
b.field("last", "quxx");
}
b.endObject();
})).rootDoc();
assertThat(doc.get(docMapper.mappers().getMapper("name.first").name()), equalTo("shay"));
assertThat(doc.get(docMapper.mappers().getMapper("name.first").name()), equalTo("fred"));
}
public void testParseToJsonAndParse() throws Exception {
@ -1017,7 +1017,7 @@ public class DocumentParserTests extends MapperServiceTestCase {
BytesReference json = new BytesArray(copyToBytesFromClasspath("/org/opensearch/index/mapper/simple/test1.json"));
Document doc = builtDocMapper.parse(new SourceToParse("test", "_doc", "1", json, XContentType.JSON)).rootDoc();
assertThat(doc.getBinaryValue(builtDocMapper.idFieldMapper().name()), equalTo(Uid.encodeId("1")));
assertThat(doc.get(builtDocMapper.mappers().getMapper("name.first").name()), equalTo("shay"));
assertThat(doc.get(builtDocMapper.mappers().getMapper("name.first").name()), equalTo("fred"));
}
public void testSimpleParser() throws Exception {
@ -1029,7 +1029,7 @@ public class DocumentParserTests extends MapperServiceTestCase {
BytesReference json = new BytesArray(copyToBytesFromClasspath("/org/opensearch/index/mapper/simple/test1.json"));
Document doc = docMapper.parse(new SourceToParse("test", "_doc", "1", json, XContentType.JSON)).rootDoc();
assertThat(doc.getBinaryValue(docMapper.idFieldMapper().name()), equalTo(Uid.encodeId("1")));
assertThat(doc.get(docMapper.mappers().getMapper("name.first").name()), equalTo("shay"));
assertThat(doc.get(docMapper.mappers().getMapper("name.first").name()), equalTo("fred"));
}
public void testSimpleParserNoTypeNoId() throws Exception {
@ -1038,7 +1038,7 @@ public class DocumentParserTests extends MapperServiceTestCase {
BytesReference json = new BytesArray(copyToBytesFromClasspath("/org/opensearch/index/mapper/simple/test1-notype-noid.json"));
Document doc = docMapper.parse(new SourceToParse("test", "_doc", "1", json, XContentType.JSON)).rootDoc();
assertThat(doc.getBinaryValue(docMapper.idFieldMapper().name()), equalTo(Uid.encodeId("1")));
assertThat(doc.get(docMapper.mappers().getMapper("name.first").name()), equalTo("shay"));
assertThat(doc.get(docMapper.mappers().getMapper("name.first").name()), equalTo("fred"));
}
public void testAttributes() throws Exception {

View File

@ -226,7 +226,7 @@ public class BoolQueryBuilderTests extends AbstractQueryTestCase<BoolQueryBuilde
" \"must\" : [ {" +
" \"term\" : {" +
" \"user\" : {" +
" \"value\" : \"kimchy\"," +
" \"value\" : \"foobar\"," +
" \"boost\" : 1.0" +
" }" +
" }" +
@ -276,7 +276,7 @@ public class BoolQueryBuilderTests extends AbstractQueryTestCase<BoolQueryBuilde
assertEquals(query, 42, queryBuilder.boost, 0.00001);
assertEquals(query, "23", queryBuilder.minimumShouldMatch());
assertEquals(query, "kimchy", ((TermQueryBuilder)queryBuilder.must().get(0)).value());
assertEquals(query, "foobar", ((TermQueryBuilder)queryBuilder.must().get(0)).value());
}
public void testMinimumShouldMatchNumber() throws IOException {

View File

@ -90,7 +90,7 @@ public class ConstantScoreQueryBuilderTests extends AbstractQueryTestCase<Consta
" \"constant_score\" : {\n" +
" \"filter\" : {\n" +
" \"terms\" : {\n" +
" \"user\" : [ \"kimchy\", \"opensearch\" ],\n" +
" \"user\" : [ \"foobar\", \"opensearch\" ],\n" +
" \"boost\" : 42.0\n" +
" }\n" +
" },\n" +

View File

@ -81,7 +81,7 @@ public class SpanFirstQueryBuilderTests extends AbstractQueryTestCase<SpanFirstQ
" \"match\" : {\n" +
" \"span_term\" : {\n" +
" \"user\" : {\n" +
" \"value\" : \"kimchy\",\n" +
" \"value\" : \"foobar\",\n" +
" \"boost\" : 1.0\n" +
" }\n" +
" }\n" +
@ -95,7 +95,7 @@ public class SpanFirstQueryBuilderTests extends AbstractQueryTestCase<SpanFirstQ
checkGeneratedJson(json, parsed);
assertEquals(json, 3, parsed.end());
assertEquals(json, "kimchy", ((SpanTermQueryBuilder) parsed.innerQuery()).value());
assertEquals(json, "foobar", ((SpanTermQueryBuilder) parsed.innerQuery()).value());
}
@ -106,7 +106,7 @@ public class SpanFirstQueryBuilderTests extends AbstractQueryTestCase<SpanFirstQ
" \"match\" : {\n" +
" \"span_term\" : {\n" +
" \"user\" : {\n" +
" \"value\" : \"kimchy\",\n" +
" \"value\" : \"foobar\",\n" +
" \"boost\" : 2.0\n" +
" }\n" +
" }\n" +

View File

@ -94,10 +94,10 @@ public class SpanTermQueryBuilderTests extends AbstractTermQueryTestCase<SpanTer
}
public void testFromJson() throws IOException {
String json = "{ \"span_term\" : { \"user\" : { \"value\" : \"kimchy\", \"boost\" : 2.0 } }}";
String json = "{ \"span_term\" : { \"user\" : { \"value\" : \"foobar\", \"boost\" : 2.0 } }}";
SpanTermQueryBuilder parsed = (SpanTermQueryBuilder) parseQuery(json);
checkGeneratedJson(json, parsed);
assertEquals(json, "kimchy", parsed.value());
assertEquals(json, "foobar", parsed.value());
assertEquals(json, 2.0, parsed.boost(), 0.0001);
}

View File

@ -261,7 +261,7 @@ public class TermsQueryBuilderTests extends AbstractQueryTestCase<TermsQueryBuil
String json =
"{\n" +
" \"terms\" : {\n" +
" \"user\" : [ \"kimchy\", \"opensearch\" ],\n" +
" \"user\" : [ \"foobar\", \"opensearch\" ],\n" +
" \"boost\" : 1.0\n" +
" }\n" +
"}";

View File

@ -108,7 +108,7 @@ public class RestValidateQueryActionTests extends AbstractSearchTestCase {
public void testRestValidateQueryAction() throws Exception {
// GIVEN a valid query
final String content = "{\"query\":{\"bool\":{\"must\":{\"term\":{\"user\":\"kimchy\"}}}}}";
final String content = "{\"query\":{\"bool\":{\"must\":{\"term\":{\"user\":\"foobar\"}}}}}";
final RestRequest request = createRestRequest(content);
final FakeRestChannel channel = new FakeRestChannel(request, true, 0);

View File

@ -1,7 +1,7 @@
{
"name":{
"first":"shay",
"last":"banon"
"first":"fred",
"last":"quxx"
},
"address":{
"first":{

View File

@ -1,7 +1,7 @@
{
"name":{
"first":"shay",
"last":"banon"
"first":"fred",
"last":"quxx"
},
"address":{
"first":{