Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,7 @@ public long count(String index, int shard, QueryBuilder query)
"GET",
format("/%s/_count?preference=_shards:%s", index, shard),
ImmutableMap.of(),
new StringEntity(sourceBuilder.toString()),
new StringEntity(sourceBuilder.toString(), UTF_8),
new BasicHeader("Content-Type", "application/json"));
}
catch (ResponseException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1536,6 +1536,38 @@ public void testFilters()
assertQuery("SELECT count(*) FROM filter_pushdown WHERE ipv6_column = IPADDRESS '2001:db8::1:0:0:1'", "VALUES 1");
}

@Test
public void testFiltersCharset()
throws IOException
{
String indexName = "filter_charset_pushdown";

@Language("JSON")
String mappings = """
{
"properties": {
"keyword_column": { "type": "keyword" },
"text_column": { "type": "text" }
}
}
""";

createIndex(indexName, mappings);

index(indexName, ImmutableMap.<String, Object>builder()
.put("keyword_column", "Türkiye")
.put("text_column", "Türkiye")
.buildOrThrow());

assertQuery("SELECT count(*) FROM filter_charset_pushdown WHERE keyword_column = 'Türkiye'", "VALUES 1");
assertQuery("SELECT count(*) FROM filter_charset_pushdown WHERE keyword_column = 'bar'", "VALUES 0");
assertQuery("SELECT count(*) FROM filter_charset_pushdown WHERE text_column = 'Türkiye'", "VALUES 1");
assertQuery("SELECT count(*) FROM filter_charset_pushdown WHERE text_column = 'some'", "VALUES 0");

assertQuery("SELECT keyword_column FROM filter_charset_pushdown WHERE keyword_column = 'Türkiye'", "VALUES ('Türkiye')");
assertQuery("SELECT text_column FROM filter_charset_pushdown WHERE text_column = 'Türkiye'", "VALUES ('Türkiye')");
}

@Test
public void testLimitPushdown()
throws IOException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,7 @@ public long count(String index, int shard, QueryBuilder query)
"GET",
format("/%s/_count?preference=_shards:%s", index, shard),
ImmutableMap.of(),
new StringEntity(sourceBuilder.toString()),
new StringEntity(sourceBuilder.toString(), UTF_8),
new BasicHeader("Content-Type", "application/json"));
}
catch (ResponseException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1583,6 +1583,38 @@ public void testFilters()
assertQuery("SELECT count(*) FROM filter_pushdown WHERE ipv6_column = IPADDRESS '2001:db8::1:0:0:1'", "VALUES 1");
}

@Test
public void testFiltersCharset()
throws IOException
{
String indexName = "filter_charset_pushdown";

@Language("JSON")
String mappings = """
{
"properties": {
"keyword_column": { "type": "keyword" },
"text_column": { "type": "text" }
}
}
""";

createIndex(indexName, mappings);

index(indexName, ImmutableMap.<String, Object>builder()
.put("keyword_column", "Türkiye")
.put("text_column", "Türkiye")
.buildOrThrow());

assertQuery("SELECT count(*) FROM filter_charset_pushdown WHERE keyword_column = 'Türkiye'", "VALUES 1");
assertQuery("SELECT count(*) FROM filter_charset_pushdown WHERE keyword_column = 'bar'", "VALUES 0");
assertQuery("SELECT count(*) FROM filter_charset_pushdown WHERE text_column = 'Türkiye'", "VALUES 1");
assertQuery("SELECT count(*) FROM filter_charset_pushdown WHERE text_column = 'some'", "VALUES 0");

assertQuery("SELECT keyword_column FROM filter_charset_pushdown WHERE keyword_column = 'Türkiye'", "VALUES ('Türkiye')");
assertQuery("SELECT text_column FROM filter_charset_pushdown WHERE text_column = 'Türkiye'", "VALUES ('Türkiye')");
}

@Test
public void testLimitPushdown()
throws IOException
Expand Down