mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-17 10:25:15 +00:00
Index level allocation filtering: Add _host option, closes #1991.
Add _host option to index level allocation filtering, which will match on either the hostname or ip address.
This commit is contained in:
parent
eb95bb50a8
commit
cf04cff273
@ -73,6 +73,20 @@ public class DiscoveryNodeFilters {
|
||||
}
|
||||
}
|
||||
return false;
|
||||
} else if ("_host".equals(attr)) {
|
||||
if (!(node.address() instanceof InetSocketTransportAddress)) {
|
||||
return false;
|
||||
}
|
||||
InetSocketTransportAddress inetAddress = (InetSocketTransportAddress) node.address();
|
||||
for (String value : values) {
|
||||
if (Regex.simpleMatch(value, inetAddress.address().getHostName())) {
|
||||
return true;
|
||||
}
|
||||
if (Regex.simpleMatch(value, inetAddress.address().getAddress().getHostAddress())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
} else if ("_id".equals(attr)) {
|
||||
for (String value : values) {
|
||||
if (node.id().equals(value)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user