-
-
Save bvader/a63d4a2ae278769f8d9b7901b2d6f39c to your computer and use it in GitHub Desktop.
Code for Semantic Search as a Service at a Search COE
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################################################################## | |
##### ELSER BLOG | |
################################################################################## | |
# Mappings | |
GET dev_wiki_elser/_search | |
DELETE dev_wiki_elser | |
PUT dev_wiki_elser | |
{ | |
"mappings": { | |
"properties": { | |
"@timestamp": { | |
"type": "date" | |
}, | |
"access": { | |
"type": "keyword" | |
}, | |
"created_at": { | |
"type": "date", | |
"format": "iso8601" | |
}, | |
"key_phrases": { | |
"type": "text" | |
}, | |
"links": { | |
"type": "text" | |
}, | |
"passages": { | |
"type": "nested", | |
"properties": { | |
"is_truncated": { | |
"type": "boolean" | |
}, | |
"model_id": { | |
"type": "text", | |
"fields": { | |
"keyword": { | |
"type": "keyword", | |
"ignore_above": 256 | |
} | |
} | |
}, | |
"passage_tokens": { | |
"type": "sparse_vector" | |
}, | |
"text": { | |
"type": "text" | |
} | |
} | |
}, | |
"source": { | |
"type": "keyword" | |
}, | |
"summary": { | |
"type": "text" | |
}, | |
"updated_at": { | |
"type": "date", | |
"format": "iso8601" | |
} | |
} | |
} | |
} | |
# Ingest Pipeline | |
DELETE _ingest/pipeline/elser-v2-dev-wiki2 | |
PUT _ingest/pipeline/elser-v2-dev-wiki2 | |
{ | |
"processors": [ | |
{ | |
"script": { | |
"description": "Chunk body into sentences by looking for . followed by a space", | |
"lang": "painless", | |
"source": """ | |
String[] envSplit = /((?<!M(r|s|rs)\.)(?<=\.) |(?<=\!) |(?<=\?) )/.split(ctx['article_content']); | |
ctx['passages'] = new ArrayList(); | |
int i = 0; | |
boolean remaining = true; | |
if (envSplit.length == 0) { | |
return | |
} else if (envSplit.length == 1) { | |
Map passage = ['text': envSplit[0]];ctx['passages'].add(passage) | |
} else { | |
while (remaining) { | |
Map passage = ['text': envSplit[i++]]; | |
while (i < envSplit.length && passage.text.length() + envSplit[i].length() < params.model_limit) {passage.text = passage.text + ' ' + envSplit[i++]} | |
if (i == envSplit.length) {remaining = false} | |
ctx['passages'].add(passage) | |
} | |
} | |
""", | |
"params": { | |
"model_limit": 400 | |
} | |
} | |
}, | |
{ | |
"foreach": { | |
"field": "passages", | |
"processor": { | |
"inference": { | |
"model_id": ".elser_model_2_linux-x86_64", | |
"input_output": [ | |
{ | |
"input_field": "_ingest._value.text", | |
"output_field": "_ingest._value.passage_tokens" | |
} | |
], | |
"on_failure": [ | |
{ | |
"append": { | |
"field": "_source._ingest.inference_errors", | |
"value": [ | |
{ | |
"message": "Processor 'inference' in pipeline 'elser-v2-dev-wiki' failed with message '{{ _ingest.on_failure_message }}'", | |
"pipeline": "elser-v2-dev-wiki", | |
"timestamp": "{{{ _ingest.timestamp }}}" | |
} | |
] | |
} | |
} | |
] | |
} | |
} | |
} | |
}, | |
{ | |
"remove": { | |
"field": [ | |
"article_content" | |
] | |
} | |
} | |
] | |
} | |
# Content 4 Articles 1 Private | |
POST dev_wiki_elser/_doc?pipeline=elser-v2-dev-wiki | |
{ | |
"summary": "IP traffic filters", | |
"access": "private", | |
"@timestamp": "2023-08-07T08:15:12.590363000Z", | |
"key_phrases": """- Traffic filtering\\n- IP address \\n- CIDR block \\n- Egress IP filters \\n- Ingress IP filters\\n- Inbound IP filters\\n- Outbound IP filters\\n- IPv4 \\n- VPC Endpoint Gateway \\n- VPC Endpoint Interface \""", | |
"updated_at": "2023-08-07T08:15:14.756374+00:00", | |
"created_at": "2023-08-03T19:54:31.260012+00:00", | |
"links": [ "https://www.elastic.co/guide/en/cloud/current/ec-traffic-filtering-ip.html"], | |
"source": "CLOUD_INFRASTRACTURE_DOCUMENT", | |
"article_content": """ | |
Traffic filtering, by IP address or CIDR block, is one of the security layers available in Elasticsearch Service. It allows you to limit how your deployments can be accessed. We have two types of filters available for filtering by IP address or CIDR block: Ingress/Inbound and Egress/Outbound (Beta, API only). | |
Ingress or inbound IP filters - These restrict access to your deployments from a set of IP addresses or CIDR blocks. These filters are available through the Elasticsearch Service console. | |
Egress or outbound IP filters - These restrict the set of IP addresses or CIDR blocks accessible from your deployment. These might be used to restrict access to a certain region or service. This feature is in beta and is currently only available through the Traffic Filtering API. | |
Read more about Traffic Filtering for the general concepts behind traffic filtering in Elasticsearch Service. | |
Follow the step described here to set up ingress or inbound IP filters through the Elasticsearch Service console. | |
Create an IP filter rule set | |
You can combine any rules into a set, so we recommend that you group rules according to what they allow, and make sure to label them accordingly. Since multiple sets can be applied to a deployment, you can be as granular in your sets as you feel is necessary. | |
To create a rule set: | |
Log in to the Elasticsearch Service Console. | |
Find your deployment on the home page in the Elasticsearch Service card and select Manage to access it directly. Or, select Dedicated deployments to go to the deployments page to view all of your deployments. | |
Under the Features tab, open the Traffic filters page. | |
Select Create filter. | |
Select IP filtering rule set. | |
Create your rule set, providing a meaningful name and description. | |
Select the region for the rule set. | |
Select if this rule set should be automatically attached to new deployments. | |
Each rule set is bound to a particular region and can be only assigned to deployments in the same region. | |
Add one or more rules using IPv4, or a range of addresses with CIDR. | |
DNS names are not supported in rules. | |
The next step is to associate one or more rule-sets with your deployments. | |
Associate an IP filter rule set with your deployment | |
After you’ve created the rule set, you’ll need to associate IP filter rules with your deployment: | |
Go to the deployment. | |
On the Security page, under Traffic filters select Apply filter. | |
Choose the filter you want to apply and select Apply filter. | |
Remove an IP filter rule set association from your deployment | |
If you want to remove any traffic restrictions from a deployment or delete a rule set, you’ll need to remove any rule set associations first. To remove an association through the UI: | |
Go to the deployment. | |
On the Security page, under Traffic filters select Remove. | |
Edit an IP filter rule set | |
You can edit a rule set name or change the allowed traffic sources using IPv4, or a range of addresses with CIDR. | |
Log in to the Elasticsearch Service Console. | |
Find your deployment on the home page in the Elasticsearch Service card and select Manage to access it directly. Or, select Dedicated deployments to go to the deployments page to view all of your deployments. | |
Under the Features tab, open the Traffic filters page. | |
Find the rule set you want to edit. | |
Select the Edit icon. | |
Delete an IP filter rule set | |
If you need to remove a rule set, you must first remove any associations with deployments. | |
To delete a rule set with all its rules: | |
Remove any deployment associations. | |
Under the Features tab, open the Traffic filters page. | |
Find the rule set you want to edit. | |
Select the Delete icon. The icon is inactive if there are deployments assigned to the rule set. | |
""" | |
} | |
POST dev_wiki_elser/_doc?pipeline=elser-v2-dev-wiki | |
{ | |
"summary": "AWS PrivateLink traffic filter", | |
"access": "public", | |
"@timestamp": "2023-08-07T08:15:12.590363000Z", | |
"key_phrases": """- AWS\\n- PrivateLink \\n- VPC \\n- VPC Endpoint \\n- VPC Endpoint Service \\n- VPC Endpoint Policy \\n- VPC Endpoint Connection \\n- VPC Endpoint Interface \\n- VPC Endpoint Gateway \\n- VPC Endpoint Interface \""", | |
"updated_at": "2023-08-07T08:15:14.756374+00:00", | |
"created_at": "2023-08-03T19:54:31.260012+00:00", | |
"links": [ "https://www.elastic.co/guide/en/cloud/current/ec-traffic-filtering-vpc.html" ], | |
"source": "CLOUD_INFRASTRACTURE_DOCUMENT", | |
"article_content": """ | |
Traffic filtering, to only AWS PrivateLink connections, is one of the security layers available in Elasticsearch Service. It allows you to limit how your deployments can be accessed. | |
Read more about Traffic Filtering for the general concepts behind traffic filtering in Elasticsearch Service. | |
PrivateLink filtering is supported only for AWS regions. AWS does not support cross-region PrivateLink connections. Your PrivateLink endpoint needs to be in the same region as your target deployments. Additional details can be found in the AWS VPCE Documentation. AWS interface VPC endpoints get created in availability zones (AZ). In some regions, our VPC endpoint service is not present in all the possible AZs that a region offers. You can only choose AZs that are common on both sides. As the names of AZs (for example us-east-1a) differ between AWS accounts, the following list of AWS regions shows the ID (e.g. use1-az4) of each available AZ for the service. Check interface endpoint availability zone considerations for more details. | |
Transport client is not supported over PrivateLink connections. | |
AWS PrivateLink establishes a secure connection between two AWS Virtual Private Clouds (VPCs). The VPCs can belong to separate accounts, i.e. a service provider and its service consumers. AWS routes the PrivateLink traffic within the AWS data center and never exposes it to the public internet. In such a configuration, Elastic Cloud is the third-party service provider and the customers are service consumers. | |
PrivateLink is a connection between a VPC Endpoint and a PrivateLink Service. | |
PrivateLink service names and aliases | |
PrivateLink Service is set up by Elastic in all supported AWS regions under the following service names: | |
AWS Public Regions | |
Region VPC Service Name Private hosted zone domain name AZ Names (AZ IDs) | |
af-south-1 | |
com.amazonaws.vpce.af-south-1.vpce-svc-0d3d7b74f60a6c32c | |
vpce.af-south-1.aws.elastic-cloud.com | |
af-south-1a (afs1-az1), af-south-1b (afs1-az2), af-south-1c (afs1-az3) | |
ap-east-1 | |
com.amazonaws.vpce.ap-east-1.vpce-svc-0f96fbfaf55558d5c | |
vpce.ap-east-1.aws.elastic-cloud.com | |
ap-east-1a (ape1-az1), ap-east-1b (ape1-az2), ap-east-1c (ape1-az3) | |
ap-northeast-1 | |
com.amazonaws.vpce.ap-northeast-1.vpce-svc-0e1046d7b48d5cf5f | |
vpce.ap-northeast-1.aws.elastic-cloud.com | |
ap-northeast-1b (apne1-az4), ap-northeast-1c (apne1-az1), ap-northeast-1d (apne1-az2) | |
ap-northeast-2 | |
com.amazonaws.vpce.ap-northeast-2.vpce-svc-0d90cf62dae682b84 | |
vpce.ap-northeast-2.aws.elastic-cloud.com | |
ap-northeast-2a (apne2-az1), ap-northeast-2b (apne2-az2), ap-northeast-2c (apne2-az3) | |
ap-south-1 | |
com.amazonaws.vpce.ap-south-1.vpce-svc-0e9c1ae5caa269d1b | |
vpce.ap-south-1.aws.elastic-cloud.com | |
ap-south-1a (aps1-az1), ap-south-1b (aps1-az3), ap-south-1c (aps1-az2) | |
ap-southeast-1 | |
com.amazonaws.vpce.ap-southeast-1.vpce-svc-0cbc6cb9bdb683a95 | |
vpce.ap-southeast-1.aws.elastic-cloud.com | |
ap-southeast-1a (apse1-az1), ap-southeast-1b (apse1-az2), ap-southeast-1c (apse1-az3) | |
ap-southeast-2 | |
com.amazonaws.vpce.ap-southeast-2.vpce-svc-0cde7432c1436ef13 | |
vpce.ap-southeast-2.aws.elastic-cloud.com | |
ap-southeast-2a (apse2-az1), ap-southeast-2b (apse2-az3), ap-southeast-2c (apse2-az2) | |
ca-central-1 | |
com.amazonaws.vpce.ca-central-1.vpce-svc-0d3e69dd6dd336c28 | |
vpce.ca-central-1.aws.elastic-cloud.com | |
ca-central-1a (cac1-az1), ca-central-1b (cac1-az2), ca-central-1d (cac1-az4) | |
eu-central-1 | |
com.amazonaws.vpce.eu-central-1.vpce-svc-081b2960e915a0861 | |
vpce.eu-central-1.aws.elastic-cloud.com | |
eu-central-1a (euc1-az2), eu-central-1b (euc1-az3), eu-central-1c (euc1-az1) | |
eu-south-1 | |
com.amazonaws.vpce.eu-south-1.vpce-svc-03d8fc8a66a755237 | |
vpce.eu-south-1.aws.elastic-cloud.com | |
eu-south-1a (eus1-az1), eu-south-1b (eus1-az2), eu-south-1c (eus1-az3) | |
eu-north-1 | |
com.amazonaws.vpce.eu-north-1.vpce-svc-05915fc851f802294 | |
vpce.eu-north-1.aws.elastic-cloud.com | |
eu-north-1a (eun1-az1), eu-north-1b (eun1-az2), eu-north-1c (eun1-az3) | |
eu-west-1 | |
com.amazonaws.vpce.eu-west-1.vpce-svc-01f2afe87944eb12b | |
vpce.eu-west-1.aws.elastic-cloud.com | |
eu-west-1a (euw1-az2), eu-west-1b (euw1-az1), eu-west-1c (euw1-az3) | |
eu-west-2 | |
com.amazonaws.vpce.eu-west-2.vpce-svc-0e42a2c194c97a1d0 | |
vpce.eu-west-2.aws.elastic-cloud.com | |
eu-west-2a (euw2-az2), eu-west-2b (euw2-az3), eu-west-2c (euw2-az1) | |
eu-west-3 | |
com.amazonaws.vpce.eu-west-3.vpce-svc-0d6912d10db9693d1 | |
vpce.eu-west-3.aws.elastic-cloud.com | |
eu-west-3a (euw3-az1), eu-west-3b (euw3-az2), eu-west-3c (euw3-az3) | |
me-south-1 | |
com.amazonaws.vpce.me-south-1.vpce-svc-0381de3eb670dcb48 | |
vpce.me-south-1.aws.elastic-cloud.com | |
me-south-3a (mes1-az1), me-south-3b (mes1-az2), me-south-3c (mes1-az3) | |
sa-east-1 | |
com.amazonaws.vpce.sa-east-1.vpce-svc-0b2dbce7e04dae763 | |
vpce.sa-east-1.aws.elastic-cloud.com | |
sa-east-1a (sae1-az1), sa-east-1b (sae1-az2), sa-east-1c (sae1-az3) | |
us-east-1 | |
com.amazonaws.vpce.us-east-1.vpce-svc-0e42e1e06ed010238 | |
vpce.us-east-1.aws.elastic-cloud.com | |
us-east-1a (use1-az4), us-east-1b (use1-az6), us-east-1e (use1-az2) | |
us-east-2 | |
com.amazonaws.vpce.us-east-2.vpce-svc-02d187d2849ffb478 | |
vpce.us-east-2.aws.elastic-cloud.com | |
us-east-2a (use2-az1), us-east-2b (use2-az2), us-east-2a (use2-az3) | |
us-west-1 | |
com.amazonaws.vpce.us-west-1.vpce-svc-00def4a16a26cb1b4 | |
vpce.us-west-1.aws.elastic-cloud.com | |
us-west-1a (usw1-az1), us-west-1b (usw1-az2), us-west-1c (usw1-az3) | |
us-west-2 | |
com.amazonaws.vpce.us-west-2.vpce-svc-0e69febae1fb91870 | |
vpce.us-west-2.aws.elastic-cloud.com | |
us-west-2a (usw2-az2), us-west-2b (usw2-az1), us-west-2c (usw2-az3) | |
GovCloud Regions | |
Region VPC Service Name Private hosted zone domain name | |
us-gov-east-1 (GovCloud) | |
com.amazonaws.vpce.us-gov-east-1.vpce-svc-0bba5ffa04f0cb26d | |
vpce.us-gov-east-1.aws.elastic-cloud.com | |
The process of setting up the PrivateLink connection to your clusters is split between AWS (e.g. by using AWS console) and Elastic Cloud UI. These are the high-level steps: | |
AWS console Elastic Cloud | |
1. Create a VPC endpoint using Elastic Cloud service name. | |
2. Create a DNS record pointing to the VPC endpoint. | |
3. Create a PrivateLink rule set with your VPC endpoint ID. | |
4. Associate the PrivateLink rule set with your deployments. | |
5. Interact with your deployments over PrivateLink. | |
Ensure your VPC endpoint is in some overlapping availability zones with the VPC service | |
You can find the zone name to zone ID mapping with AWS CLI: | |
$ aws ec2 describe-availability-zones --region us-east-1 | jq -c '.AvailabilityZones[] | { id: .ZoneId, name: .ZoneName } ' | sort | |
{"id":"use1-az1","name":"us-east-1c"} | |
{"id":"use1-az2","name":"us-east-1e"} | |
{"id":"use1-az3","name":"us-east-1d"} | |
{"id":"use1-az4","name":"us-east-1a"} | |
{"id":"use1-az5","name":"us-east-1f"} | |
{"id":"use1-az6","name":"us-east-1b"} | |
The mapping will be different for your region. Our production VPC Service for us-east-1 is located in use1-az2, use1-az4, use1-az6. We need to create the VPC Endpoint for the preceding mapping in at least one of us-east-1a, us-east-1d, us-east-1b. | |
Create your VPC endpoint and DNS entries in AWS | |
Create a VPC endpoint in your VPC using the service name for your region. | |
Follow the AWS instructions for details on creating a VPC interface endpoint to an endpoint service. | |
Use the service name for your region. | |
PrivateLink | |
The security group for the endpoint should at minimum allow for inbound connectivity from your instances CIDR range on ports 443 and 9243. Security groups for the instances should allow for outbound connnectibity to the endpoint on ports 443 and 9243. | |
Create a DNS record. | |
Create a Private hosted zone. Consult Private hosted zone domain name in PrivateLink service names and aliases for the name of the zone. For example, in us-east-1 use vpce.us-east-1.aws.elastic-cloud.com as the zone domain name. Don’t forget to associate the zone with your VPC. | |
Private hosted zone example | |
Then create a DNS CNAME alias pointing to the PrivateLink Endpoint. Add the record to a private DNS zone in your VPC. Use * as the record name, and the VPC endpoint DNS name as a value. | |
Follow the AWS instructions for details on creating a CNAME record which points to your VPC endpoint DNS name. | |
PrivateLink CNAME | |
Test the connection. | |
Find out the endpoint of your deployment. You can do that by selecting Copy endpoint in the Cloud UI. It looks something like my-deployment-d53192.es.us-east-1.aws.found.io. my-deployment-d53192 is an alias, and es is the product you want to access within your deployment. | |
To access your Elasticsearch cluster over PrivateLink: | |
If you have a custom endpoint alias configured, you can use the custom endpoint URL to connect. | |
Alternatively, use the following URL structure: | |
https://{alias}.{product}.{private_hosted_zone_domain_name} | |
For example: | |
https://my-deployment-d53192.es.vpce.us-east-1.aws.elastic-cloud.com | |
You can use either 443, or 9243 as a port. | |
You can test the AWS console part of the setup with a following curl (substitute the region and Elasticsearch ID with your cluster): | |
$ curl -v https://my-deployment-d53192.es.vpce.us-east-1.aws.elastic-cloud.com | |
.. | |
* Server certificate: | |
* subject: CN=*.us-east-1.aws.elastic-cloud.com | |
* SSL certificate verify ok. | |
.. | |
{"ok":false,"message":"Forbidden"} | |
* Connection #0 to host my-deployment-d53192.es.vpce.us-east-1.aws.elastic-cloud.com left intact | |
The connection is established, and a valid certificate is presented to the client. The 403 Forbidden is expected, because you haven’t allowed the traffic over this PrivateLink connection yet. | |
Add the private link rules to your deployments | |
Follow these high-level steps to add private link rules to your deployments. | |
Find your VPC endpoint ID. | |
Create rules using the VPC endpoint. | |
Associate the VPC endpoint with your deployment. | |
Access the deployment over a private link. | |
Finding your VPC endpoint ID | |
Having trouble finding your VPC endpoint ID? You can find it in the AWS console. | |
VPC Endpoint ID | |
Create rules with the VPC endpoint | |
Once you know your VPC endpoint ID you can create a private link traffic filter rule set. | |
Log in to the Elasticsearch Service Console. | |
Find your deployment on the home page in the Elasticsearch Service card and select Manage to access it directly. Or, select Dedicated deployments to go to the deployments page to view all of your deployments. | |
Under the Features tab, open the Traffic filters page. | |
Select Create filter. | |
Select Private link endpoint. | |
Create your rule set, providing a meaningful name and description. | |
Select the region for the rule set. | |
Enter your VPC endpoint ID. | |
Select if this rule set should be automatically attached to new deployments. | |
Each rule set is bound to a particular region and can be only assigned to deployments in the same region. | |
(Optional) You can claim your VPC endpoint ID, so that no other organization is able to use it in a traffic filter ruleset. | |
The next step is to associate the rule set with your deployments. | |
Associate a PrivateLink rule set with your deployment | |
To associate a private link rule set with your deployment: | |
Go to the deployment. | |
On the Security page, under Traffic filters select Apply filter. | |
Choose the filter you want to apply and select Apply filter. | |
Access the deployment over a PrivateLink | |
For traffic to connect with the deployment over a PrivateLink, the client making the request needs to be located within the VPC where you’ve created the VPC endpoint. You can also setup network traffic to flow through the originating VPC from somewhere else, such as another VPC or VPN from your corporate network. This assumes that the VPC endpoint and the DNS record are also available within that context. Check your service provider documentation for setup instructions. | |
Use the alias you’ve set up as CNAME DNS record to access your deployment. | |
If your deployment alias is my-deployment-12ab9b and it is located in us-east-1 region you can access it under https://my-deployment-12ab9b.es.vpce.us-east-1.aws.elastic-cloud.com. | |
$ curl -u 'username:password' -v https://my-deployment-d53192.es.vpce.us-east-1.aws.elastic-cloud.com | |
.. | |
< HTTP/1.1 200 OK | |
.. | |
If you are using AWS PrivateLink together with Fleet, and enrolling the Elastic Agent with a PrivateLink URL, you need to configure Fleet Server to use and propagate the PrivateLink URL by updating the Fleet Server hosts field in the Fleet settings section of Kibana. Otherwise, Elastic Agent will reset to use a default address instead of the PrivateLink URL. The URL needs to follow this pattern: https://<Fleet cluster ID/deployment alias>.fleet.<Private hosted zone domain name>:443. | |
Similarly, the Elasticsearch host needs to be updated to propagate the Privatelink URL. The Elasticsearch URL needs to follow this pattern: https://<Elasticsearch cluster ID/deployment alias>.es.<Private hosted zone domain name>:443. | |
The settings xpack.fleet.agents.fleet_server.hosts and xpack.fleet.outputs that are needed to enable this configuration in Kibana are currently available on-prem only, and not in the Kibana settings in Elastic Cloud. | |
Edit a PrivateLink connection | |
You can edit a rule set name or to change the VPC endpoint ID. | |
Log in to the Elasticsearch Service Console. | |
Find your deployment on the home page in the Elasticsearch Service card and select Manage to access it directly. Or, select Dedicated deployments to go to the deployments page to view all of your deployments. | |
Under the Features tab, open the Traffic filters page. | |
Find the rule set you want to edit. | |
Select the Edit icon. | |
Delete a PrivateLink rule set | |
If you need to remove a rule set, you must first remove any associations with deployments. | |
To delete a rule set with all its rules: | |
Remove any deployment associations. | |
Under the Features tab, open the Traffic filters page. | |
Find the rule set you want to edit. | |
Select the Remove icon. The icon is inactive if there are deployments assigned to the rule set. | |
Remove a PrivateLink rule set association from your deployment | |
To remove an association through the UI: | |
Go to the deployment. | |
On the Security page, under Traffic filters select Remove. | |
""" | |
} | |
POST dev_wiki_elser/_doc?pipeline=elser-v2-dev-wiki | |
{ | |
"summary": "Google Private Service Connect", | |
"access": "public", | |
"@timestamp": "2023-08-03T19:55:59.922258000Z", | |
"key_phrases": """- Google\\n- GCP\\n- Private Service Connect - Private Service Connect \\n- Private Service Connect endpoint \\n- PSC Connect \\n- VPC \""", | |
"updated_at": "2023-08-16T18:13:06.195478+00:00", | |
"created_at": "2023-08-03T19:55:59.922258+00:00", | |
"links": [ "https://www.elastic.co/guide/en/cloud/current/ec-traffic-filtering-psc.html"], | |
"source": "CLOUD_INFRASTRACTURE_DOCUMENT", | |
"article_content": """ | |
Traffic filtering, to allow only Private Service Connect connections, is one of the security layers available in Elasticsearch Service. It allows you to limit how your deployments can be accessed. | |
Read more about Traffic Filtering for the general concepts behind traffic filtering in Elasticsearch Service. | |
Private Service Connect filtering is supported only for Google Cloud regions. | |
Private Service Connect establishes a secure connection between two Google Cloud VPCs. The VPCs can belong to separate accounts, for example a service provider and their service consumers. Google Cloud routes the Private Service Connect traffic within the Google Cloud data centers and never exposes it to the public internet. In such a configuration, Elastic Cloud is the third-party service provider and the customers are service consumers. | |
Private Link is a connection between a Private Service Connect Endpoint and a Service Attachment. Learn more about using Private Service Connect on Google Cloud. | |
Private Service Connect connections are regional, your Private Service Connect Endpoint needs to live in the same region as your deployment. The Endpoint can be accessed from any region once you enable its Global Access feature. | |
Private Service Connect URIs | |
Service Attachments are set up by Elastic in all supported GCP regions under the following URIs: | |
Region Service Attachment URI Private zone DNS name | |
asia-east1 | |
projects/cloud-production-168820/regions/asia-east1/serviceAttachments/proxy-psc-production-asia-east1-v1-attachment | |
psc.asia-east1.gcp.elastic-cloud.com | |
asia-northeast1 | |
projects/cloud-production-168820/regions/asia-northeast1/serviceAttachments/proxy-psc-production-asia-northeast1-v1-attachment | |
psc.asia-northeast1.gcp.cloud.es.io | |
asia-northeast3 | |
projects/cloud-production-168820/regions/asia-northeast3/serviceAttachments/proxy-psc-production-asia-northeast3-v1-attachment | |
psc.asia-northeast3.gcp.elastic-cloud.com | |
asia-south1 | |
projects/cloud-production-168820/regions/asia-south1/serviceAttachments/proxy-psc-production-asia-south1-v1-attachment | |
psc.asia-south1.gcp.elastic-cloud.com | |
asia-southeast1 | |
projects/cloud-production-168820/regions/asia-southeast1/serviceAttachments/proxy-psc-production-asia-southeast1-v1-attachment | |
psc.asia-southeast1.gcp.elastic-cloud.com | |
asia-southeast2 | |
projects/cloud-production-168820/regions/asia-southeast2/serviceAttachments/proxy-psc-production-asia-southeast2-v1-attachment | |
psc.asia-southeast2.gcp.elastic-cloud.com | |
australia-southeast1 | |
projects/cloud-production-168820/regions/australia-southeast1/serviceAttachments/proxy-psc-production-australia-southeast1-v1-attachment | |
psc.australia-southeast1.gcp.elastic-cloud.com | |
europe-north1 | |
projects/cloud-production-168820/regions/europe-north1/serviceAttachments/proxy-psc-production-europe-north1-v1-attachment | |
psc.europe-north1.gcp.elastic-cloud.com | |
europe-west1 | |
projects/cloud-production-168820/regions/europe-west1/serviceAttachments/proxy-psc-production-europe-west1-v1-attachment | |
psc.europe-west1.gcp.cloud.es.io | |
europe-west2 | |
projects/cloud-production-168820/regions/europe-west2/serviceAttachments/proxy-psc-production-europe-west2-v1-attachment | |
psc.europe-west2.gcp.elastic-cloud.com | |
europe-west3 | |
projects/cloud-production-168820/regions/europe-west3/serviceAttachments/proxy-psc-production-europe-west3-v1-attachment | |
psc.europe-west3.gcp.cloud.es.io | |
europe-west4 | |
projects/cloud-production-168820/regions/europe-west4/serviceAttachments/proxy-psc-production-europe-west4-v1-attachment | |
psc.europe-west4.gcp.elastic-cloud.com | |
europe-west9 | |
projects/cloud-production-168820/regions/europe-west9/serviceAttachments/proxy-psc-production-europe-west9-v1-attachment | |
psc.europe-west9.gcp.elastic-cloud.com | |
northamerica-northeast1 | |
projects/cloud-production-168820/regions/northamerica-northeast1/serviceAttachments/proxy-psc-production-northamerica-northeast1-v1-attachment | |
psc.northamerica-northeast1.gcp.elastic-cloud.com | |
southamerica-east1 | |
projects/cloud-production-168820/regions/southamerica-east1/serviceAttachments/proxy-psc-production-southamerica-east1-v1-attachment | |
psc.southamerica-east1.gcp.elastic-cloud.com | |
us-central1 | |
projects/cloud-production-168820/regions/us-central1/serviceAttachments/proxy-psc-production-us-central1-v1-attachment | |
psc.us-central1.gcp.cloud.es.io | |
us-east1 | |
projects/cloud-production-168820/regions/us-east1/serviceAttachments/proxy-psc-production-us-east1-v1-attachment | |
psc.us-east1.gcp.elastic-cloud.com | |
us-east4 | |
projects/cloud-production-168820/regions/us-east4/serviceAttachments/proxy-psc-production-us-east4-v1-attachment | |
psc.us-east4.gcp.elastic-cloud.com | |
us-west1 | |
projects/cloud-production-168820/regions/us-west1/serviceAttachments/proxy-psc-production-us-west1-v1-attachment | |
psc.us-west1.gcp.cloud.es.io | |
The process of setting up the Private link connection to your clusters is split between Google Cloud (e.g. by using Google Cloud console), and Elastic Cloud UI. These are the high-level steps: | |
Google Cloud console Elastic Cloud UI | |
1. Create a Private Service Connect endpoint using Elastic Cloud Service Attachment URI. | |
2. Create a DNS record pointing to the Private Service Connect endpoint. | |
3. Create a Private Service Connect rule set with the PSC Connection ID. | |
4. Associate the Private Service Connect rule set with your deployments. | |
5. Interact with your deployments over Private Service Connect. | |
Create your Private Service Connect endpoint and DNS entries in Google Cloud | |
Create a Private Service Connect endpoint in your VPC using the Service Attachment URI for your region. | |
Follow the Google Cloud instructions for details on creating a Private Service Connect endpoint to access Private Service Connect services. | |
Use the Service Attachment URI for your region. Select the Published service option and enter the selected Service Attachment URI as the Target service. For example for the region asia-southeast1 the Service Attachment URI is projects/cloud-production-168820/regions/asia-southeast1/serviceAttachments/proxy-psc-production-asia-southeast1-v1-attachment | |
you need to reserve a static internal IP address in your VPC. The address is used by Private Service Connect endpoint. | |
Note down the PSC Connection ID, e.g. 18446744072646845332. | |
Create a DNS record. | |
Create a DNS Zone of type Private. Set the DNS name to Private zone DNS name for your region. For example, in asia-southeast1 use psc.asia-southeast1.gcp.elastic-cloud.com as the zone domain name. Make sure the zone is associated with your VPC. | |
Then create a DNS record set with an A record pointing to the Private Service Connect endpoint IP. Use * as the DNS name, A as the Resource Record Type, and put the Private Service Connect endpoint IP address as the record value. | |
Follow the Google Cloud instructions for details on creating an A record which points to your Private Service Connect endpoint IP address. | |
Test the connection. | |
Find out the Elasticsearch cluster ID of your deployment. You can do that by selecting Copy cluster id in the Cloud UI. It looks something like 9c794b7c08fa494b9990fa3f6f74c2f8. | |
The Elasticsearch cluster ID is different from the deployment ID, custom alias endpoint, and Cloud ID values that feature prominently in the user console. | |
To access your Elasticsearch cluster over Private Link:, | |
If you have a custom endpoint alias configured, you can use the custom endpoint URL to connect. | |
https://{alias}.{product}.{private_hosted_zone_domain_name} | |
For example: | |
https://my-deployment-d53192.es.psc.asia-southeast1.gcp.elastic-cloud.com | |
Alternatively, use the following URL structure: | |
https://{elasticsearch_cluster_ID}.{private_hosted_zone_domain_name}:9243 | |
For example: | |
https://6b111580caaa4a9e84b18ec7c600155e.psc.asia-southeast1.gcp.elastic-cloud.com:9243 | |
You can test the Google Cloud console part of the setup with the following command (substitute the region and Elasticsearch ID with your cluster): | |
$ curl -v https://6b111580caaa4a9e84b18ec7c600155e.psc.asia-southeast1.gcp.elastic-cloud.com:9243 | |
.. | |
* Trying 192.168.100.2... | |
.. | |
< HTTP/2 403 | |
.. | |
{"ok":false,"message":"Forbidden"} | |
Check the IP address 192.168.100.2. it should be the same as the IP address assigned to your Private Service Connect endpoint. | |
The connection is established, and a valid certificate is presented to the client. The 403 Forbidden is expected, you haven’t associated any deployment with the Private Service Connect endpoint yet. | |
Add the Private Service Connect rules to your deployments | |
Follow these high-level steps to add private link rules to your deployments. | |
Find your Private Service Connect connection ID. | |
Create rules using the Private Service Connect endpoint connection ID. | |
Associate the Private Service Connect endpoint with your deployment. | |
Access the deployment over the Private Service Connect. | |
Find your Private Service Connect connection ID | |
Go to your Private Service Connect endpoint in the Google Cloud console. | |
Copy the value of PSC Connection ID. | |
Create rules using the Private Service Connect endpoint connection ID | |
When you have your Private Service Connect endpoint connection ID, you can create a traffic filter rule set. | |
From the Account menu, select Traffic filters. | |
Select Create filter. | |
Select Private Service Connect endpoint. | |
Create your rule set, providing a meaningful name and description. | |
Select the region for the rule set. | |
Enter your PSC Connection ID. | |
Select if this rule set should be automatically attached to new deployments. | |
Each rule set is bound to a particular region and can be only assigned to deployments in the same region. | |
(Optional) You can claim your PSC Connection ID, so that no other organization is able to use it in a traffic filter ruleset. | |
The next step is to associate the rule set with your deployments. | |
Associate the Private Service Connect endpoint with your deployment | |
To associate a private link rule set with your deployment: | |
Go to the deployment. | |
On the Security page, under Traffic filters select Apply filter. | |
Choose the filter you want to apply and select Apply filter. | |
Access the deployment over the Private Service Connect | |
For traffic to connect with the deployment over Private Service Connect, the client making the request needs to be located within the VPC where you’ve created the Private Service Connect endpoint. You can also setup network traffic to flow through the originating VPC from somewhere else, such as another VPC or a VPN from your corporate network. This assumes that the Private Service Connect endpoint and the DNS record are also available within that context. Check your cloud service provider documentation for setup instructions. | |
Use the alias you’ve set up as CNAME A record to access your deployment. | |
For example, if your Elasticsearch ID is 6b111580caaa4a9e84b18ec7c600155e and it is located in asia-southeast1 region you can access it under https://6b111580caaa4a9e84b18ec7c600155e.psc.asia-southeast1.gcp.elastic-cloud.com:9243. | |
$ curl -u 'username:password' -v https://6b111580caaa4a9e84b18ec7c600155e.psc.asia-southeast1.gcp.elastic-cloud.com:9243 | |
.. | |
< HTTP/1.1 200 OK | |
.. | |
If you are using Private Service Connect together with Fleet, and enrolling the Elastic Agent with a Private Service Connect URL, you need to configure Fleet Server to use and propagate the Private Service Connect URL by updating the Fleet Server hosts field in the Fleet settings section of Kibana. Otherwise, Elastic Agent will reset to use a default address instead of the Private Service Connect URL. The URL needs to follow this pattern: https://<Fleet cluster ID/deployment alias>.fleet.<private zone DNS name>:443. | |
Similarly, the Elasticsearch host needs to be updated to propagate the Private Service Connect URL. The Elasticsearch URL needs to follow this pattern: https://<Elasticsearch cluster ID/deployment alias>.es.<private zone DNS name>:443. | |
The settings xpack.fleet.agents.fleet_server.hosts and xpack.fleet.outputs that are needed to enable this configuration in Kibana are currently available on-prem only, and not in the Kibana settings in Elastic Cloud. | |
Edit a Private Service Connect rule set | |
You can edit a rule set name or to change the PSC connection ID. | |
From the Account menu, select Traffic filters. | |
Find the rule set you want to edit. | |
Select the Edit icon. | |
Delete a Private Service Connect rule set | |
If you need to remove a rule set, you must first remove any associations with deployments. | |
To delete a rule set with all its rules: | |
Remove any deployment associations. | |
From the Account menu, select Traffic filters. | |
Find the rule set you want to edit. | |
Select the Remove icon. The icon is inactive if there are deployments assigned to the rule set. | |
Remove a Private Service Connect rule set association from your deployment | |
To remove an association through the UI: | |
Go to the deployment. | |
On the Security page, under Traffic filters select Remove. | |
""" | |
} | |
POST dev_wiki_elser/_doc?pipeline=elser-v2-dev-wiki | |
{ | |
"summary": "Azure Private Link", | |
"access": "public", | |
"@timestamp": "2023-07-31T21:30:38.987248000Z", | |
"key_phrases": """- Azure\\n- Private Link\\n- Private Endpoint\\n- VNet \\n- Private Link Connection \""", | |
"updated_at": "2023-06-07T08:01:14.458151+00:00", | |
"created_at": "2023-05-29T08:01:14.458151+00:00", | |
"links": [ "https://www.elastic.co/guide/en/cloud/current/ec-traffic-filtering-vnet.html"], | |
"source": "CLOUD_INFRASTRACTURE_DOCUMENT", | |
"article_content": """ | |
Traffic filtering, to allow only Azure Private Link connections, is one of the security layers available in Elasticsearch Service. It allows you to limit how your deployments can be accessed. | |
Read more about Traffic Filtering for the general concepts behind traffic filtering in Elasticsearch Service. | |
Azure Private Link filtering is supported only for Azure regions. | |
Azure Private Link establishes a secure connection between two Azure VNets. The VNets can belong to separate accounts, for example a service provider and their service consumers. Azure routes the Private Link traffic within the Azure data centers and never exposes it to the public internet. In such a configuration, Elastic Cloud is the third-party service provider and the customers are service consumers. | |
Private Link is a connection between an Azure Private Endpoint and a Azure Private Link Service. | |
Azure Private Link Service aliases | |
Private Link Services are set up by Elastic in all supported Azure regions under the following aliases: | |
Region Azure Private Link Service Alias Private hosted zone domain name | |
australiaeast | |
australiaeast-prod-012-privatelink-service.a0cf0c1a-33ab-4528-81e7-9cb23608f94e.australiaeast.azure.privatelinkservice | |
privatelink.australiaeast.azure.elastic-cloud.com | |
centralus | |
centralus-prod-009-privatelink-service.49a041f7-2ad1-4bd2-9898-fba7f7a1ff77.centralus.azure.privatelinkservice | |
privatelink.centralus.azure.elastic-cloud.com | |
eastus2 | |
eastus2-prod-002-privatelink-service.64359fdd-7893-4215-9929-ece3287e1371.eastus2.azure.privatelinkservice | |
privatelink.eastus2.azure.elastic-cloud.com | |
francecentral | |
francecentral-prod-008-privatelink-service.8ab667fd-e8af-44b2-a347-bd48d109afec.francecentral.azure.privatelinkservice | |
privatelink.francecentral.azure.elastic-cloud.com | |
japaneast | |
japaneast-prod-006-privatelink-service.cfcf2172-917a-4260-b002-3e7183e56fd0.japaneast.azure.privatelinkservice | |
privatelink.japaneast.azure.elastic-cloud.com | |
northeurope | |
northeurope-prod-005-privatelink-service.163e4238-bdde-4a0b-a812-04650bfa41c4.northeurope.azure.privatelinkservice | |
privatelink.northeurope.azure.elastic-cloud.com | |
southeastasia | |
southeastasia-prod-004-privatelink-service.20d67dc0-2a36-40a0-af8d-0e1f997a419d.southeastasia.azure.privatelinkservice | |
privatelink.southeastasia.azure.elastic-cloud.com | |
uksouth | |
uksouth-prod-007-privatelink-service.98758729-06f7-438d-baaa-0cb63e737cdf.uksouth.azure.privatelinkservice | |
privatelink.uksouth.azure.elastic-cloud.com | |
westeurope | |
westeurope-prod-001-privatelink-service.190cd496-6d79-4ee2-8f23-0667fd5a8ec1.westeurope.azure.privatelinkservice | |
privatelink.westeurope.azure.elastic-cloud.com | |
westus2 | |
westus2-prod-003-privatelink-service.b9c176b8-4fe9-41f9-916c-67cacd753ca1.westus2.azure.privatelinkservice | |
privatelink.westus2.azure.elastic-cloud.com | |
eastus | |
eastus-prod-010-privatelink-service.b5765cd8-1fc8-45e9-91fc-a9b208369f9a.eastus.azure.privatelinkservice | |
privatelink.eastus.azure.elastic-cloud.com | |
southcentralus | |
southcentralus-prod-013-privatelink-service.f8030986-5fb9-4b0e-8463-69604233b07e.southcentralus.azure.privatelinkservice | |
privatelink.southcentralus.azure.elastic-cloud.com | |
canadacentral | |
canadacentral-prod-011-privatelink-service.203896f1-da53-4c40-b7db-0ba4e17a1019.canadacentral.azure.privatelinkservice | |
privatelink.canadacentral.azure.elastic-cloud.com | |
brazilsouth | |
brazilsouth-prod-014-privatelink-service.05813ca4-cd0f-4692-ad69-a339d023f666.brazilsouth.azure.privatelinkservice | |
privatelink.brazilsouth.azure.elastic-cloud.com | |
centralindia | |
centralindia-prod-016-privatelink-service.071806ca-8101-425b-ae86-737935a719d3.centralindia.azure.privatelinkservice | |
privatelink.centralindia.azure.elastic-cloud.com | |
southafricanorth | |
southafricanorth-prod-015-privatelink-service.b443098d-6382-42aa-9025-e0cd3ec9c103.southafricanorth.azure.privatelinkservice | |
privatelink.southafricanorth.azure.elastic-cloud.com | |
The process of setting up the Private link connection to your clusters is split between Azure (e.g. by using Azure portal), Elastic Cloud Support, and Elastic Cloud UI. These are the high-level steps: | |
Azure portal Elastic Cloud UI | |
1. Create a private endpoint using Elastic Cloud service alias. | |
2. Create a DNS record pointing to the private endpoint. | |
3. Create an Azure Private Link rule set with the private endpoint Name and ID. | |
4. Associate the Azure Private Link rule set with your deployments. | |
5. Interact with your deployments over Private Link. | |
Create your private endpoint and DNS entries in Azure | |
Create a private endpoint in your VNet using the alias for your region. | |
Follow the Azure instructions for details on creating a private endpoint to an endpoint service. | |
Use the service aliases for your region. Select the "Connect to an Azure resource by resource ID or alias" option. For example for the region eastus2 the service alias is eastus2-prod-002-privatelink-service.64359fdd-7893-4215-9929-ece3287e1371.eastus2.azure.privatelinkservice | |
You will notice that the Private Link endpoint is in the Awaiting Approval state. We validate and approve the endpoints when you create the ruleset using the Private Link resource name and resource ID, as described in the next section Add the Private Link rules to your deployments. | |
Create a DNS record. | |
Create a Private DNS Zone. Get the private hosted zone domain name in Azure Private Link Service Alias for the name of the zone. For example, in eastus2 use privatelink.*eastus2*.azure.elastic-cloud.com as the zone domain name. Using this zone domain name is required to ensure certificate names match. | |
After creating the Private DNS Zone, associate the zone with your VNet by creating a virtual network link. | |
Then create a DNS A record pointing to the private endpoint. Use * as the record name, A as the type, and put the private endpoint IP address as the record value. | |
Follow the Azure instructions for details on creating an A record which points to your private endpoint IP address. | |
The private endpoint IP address is available through the network interface for the private endpoint. | |
Add the Private Link rules to your deployments | |
Follow these high-level steps to add Private Link rules to your deployments. | |
Find your private endpoint resource name. | |
Find your private endpoint resource ID. | |
Create rules using the Private Link Endpoint Resource Name and Resource ID. | |
Associate the private endpoint with your deployment. | |
Access the deployment over a Private Link. | |
Find your private endpoint resource name | |
Go to your Private Link Endpoint in the Azure Portal. | |
Select JSON View. | |
Copy the value of the top level name property. | |
Find your private endpoint resource ID | |
Go to your Private Link Endpoint in the Azure Portal. | |
Select JSON View. | |
Copy the value of the properties.resourceGUID property. | |
Private endpoint JSON View | |
Private endpoint Properties | |
Create rules using the Private Link Endpoint Resource Name and Resource ID | |
When you have your private endpoint name and ID, you can create a Private Link traffic filter rule set. | |
From the Account menu, select Traffic filters. | |
Select Create filter. | |
Select Private link endpoint. | |
Create your rule set, providing a meaningful name and description. | |
Select the region for the rule set. | |
Enter your Private Endpoint Resource Name and Resource ID. | |
Select if this rule set should be automatically attached to new deployments. | |
Each rule set is bound to a particular region and can be only assigned to deployments in the same region. | |
(Optional) You can claim your Private Endpoint Resource Name and Resource ID, so that no other organization is able to use it in a traffic filter ruleset. | |
Creating the filter approves the Private Link connection. | |
Let’s test the connection: | |
Find out the Elasticsearch cluster ID of your deployment. You can do that by selecting Copy cluster id in the Cloud UI. It looks something like 9c794b7c08fa494b9990fa3f6f74c2f8. | |
The Elasticsearch cluster ID is different from the deployment ID, custom alias endpoint, and Cloud ID values that feature prominently in the user console. | |
To access your Elasticsearch cluster over Private Link: | |
If you have a custom endpoint alias configured, you can use the custom endpoint URL to connect. | |
https://{alias}.{product}.{private_hosted_zone_domain_name} | |
For example: | |
https://my-deployment-d53192.es.privatelink.eastus2.azure.elastic-cloud.com | |
Alternatively, use the following URL structure: | |
https://{elasticsearch_cluster_ID}.{private_hosted_zone_domain_name}:9243 | |
For example: | |
https://6b111580caaa4a9e84b18ec7c600155e.privatelink.eastus2.azure.elastic-cloud.com:9243 | |
You can test the Azure portal part of the setup with the following command (substitute the region and Elasticsearch ID with your cluster). | |
The output should look like this: | |
$ curl -v https://6b111580caaa4a9e84b18ec7c600155e.privatelink.eastus2.azure.elastic-cloud.com:9243 | |
* Rebuilt URL to: https://6b111580caaa4a9e84b18ec7c600155e.privatelink.eastus2.azure.elastic-cloud.com:9243/ | |
* Trying 192.168.46.5... # <== note this IP address | |
.. | |
* SSL connection using TLS1.2 / ECDHE_RSA_AES_256_GCM_SHA384 | |
* server certificate verification OK | |
* common name: *.privatelink.elastic-cloud.com (matched) | |
.. | |
< HTTP/1.1 403 Forbidden | |
{"ok":false,"message":"Forbidden"} | |
Check the IP address 192.168.46.5 it should be the same as the IP address of your private endpoint. | |
The connection is established, and a valid certificate is presented to the client. The 403 Forbidden is expected, you haven’t associate the rule set with any deployment yet. | |
In the event that the Private Link connection is not approved by Elastic Cloud, you’ll get an error message like the following. Double check that the filter you’ve created in the previous step uses the right resource name and GUID. | |
$ curl -v https://6b111580caaa4a9e84b18ec7c600155e.privatelink.eastus2.azure.elastic-cloud.com:9243 | |
* Rebuilt URL to: https://6b111580caaa4a9e84b18ec7c600155e.privatelink.eastus2.azure.elastic-cloud.com:9243/ | |
* Trying 192.168.46.5... | |
* connect to 192.168.46.5 port 9243 failed: No route to host | |
* Failed to connect to 6b111580caaa4a9e84b18ec7c600155e.privatelink.eastus2.azure.elastic-cloud.com port 9243: No route to host | |
* Closing connection 0 | |
curl: (7) Failed to connect to 6b111580caaa4a9e84b18ec7c600155e.privatelink.eastus2.azure.elastic-cloud.com port 9243: No route to host | |
The next step is to associate the rule set with your deployments. | |
Associate a Private Link rule set with your deployment | |
To associate a Private Link rule set with your deployment: | |
Go to the deployment. | |
On the Security page, under Traffic filters select Apply filter. | |
Choose the filter you want to apply and select Apply filter. | |
Access the deployment over a Private Link | |
For traffic to connect with the deployment over Azure Private Link, the client making the request needs to be located within the VNet where you’ve created the private endpoint. You can also setup network traffic to flow through the originating VNet from somewhere else, such as another VNet or a VPN from your corporate network. This assumes that the private endpoint and the DNS record are also available within that context. Check your service provider documentation for setup instructions. | |
Use the alias you’ve set up as CNAME A record to access your deployment. | |
For example, if your Elasticsearch ID is 6b111580caaa4a9e84b18ec7c600155e and it is located in eastus2 region you can access it under https://6b111580caaa4a9e84b18ec7c600155e.privatelink.eastus2.azure.elastic-cloud.com:9243. | |
$ curl -u 'username:password' -v https://6b111580caaa4a9e84b18ec7c600155e.privatelink.eastus2.azure.elastic-cloud.com:9243 | |
.. | |
< HTTP/1.1 200 OK | |
.. | |
If you are using Azure Private Link together with Fleet, and enrolling the Elastic Agent with a Private Link URL, you need to configure Fleet Server to use and propagate the Private Link URL by updating the Fleet Server hosts field in the Fleet settings section of Kibana. Otherwise, Elastic Agent will reset to use a default address instead of the Private Link URL. The URL needs to follow this pattern: https://<Fleet cluster ID/deployment alias>.fleet.<Private hosted zone domain name>:443. | |
Similarly, the Elasticsearch host needs to be updated to propagate the Private Link URL. The Elasticsearch URL needs to follow this pattern: https://<Elasticsearch cluster ID/deployment alias>.es.<Private hosted zone domain name>:443. | |
The settings xpack.fleet.agents.fleet_server.hosts and xpack.fleet.outputs that are needed to enable this configuration in Kibana are currently available on-prem only, and not in the Kibana settings in Elastic Cloud. | |
Edit a Private Link connection | |
You can edit a rule set name or to change the VPC endpoint ID. | |
From the Account menu, select Traffic filters. | |
Find the rule set you want to edit. | |
Select the Edit icon. | |
Delete a Private Link rule set | |
If you need to remove a rule set, you must first remove any associations with deployments. | |
To delete a rule set with all its rules: | |
Remove any deployment associations. | |
From the Account menu, select Traffic filters. | |
Find the rule set you want to edit. | |
Select the Remove icon. The icon is inactive if there are deployments assigned to the rule set. | |
Remove a Private Link rule set association from your deployment | |
To remove an association through the UI: | |
Go to the deployment. | |
On the Security page, under Traffic filters select Remove. | |
Setting up an inter-region Private Link connection | |
Azure supports inter-region Private Link as described in the Azure documentation. "The Private Link resource can be deployed in a different region than the virtual network and private endpoint." | |
This means your deployment on Elastic Cloud can be in a different region than the Private Link endpoints or the clients that consume the deployment endpoints. | |
Inter-region Private Link | |
Set up Private Link Endpoint in region 1 for a deployment hosted in region 2. | |
Create your Private Endpoint using the service alias for region 2 in the region 1 VNET (let’s call this VNET1). | |
Create a Private Hosted Zone for region 2, and associate it with VNET1 similar to the step Create a Private Link endpoint and DNS. Note that you are creating these resources in region 1, VNET1. | |
Create a traffic filter rule set and Associate the rule set through the Elasticsearch Service Console, just as you would for any deployment. | |
Test the connection from a VM or client in region 1 to your Private Link endpoint, and it should be able to connect to your Elasticsearch cluster hosted in region 2. | |
""" | |
} | |
# Quick Search to check data | |
GET dev_wiki_elser/_search | |
GET dev_wiki_elser/_search | |
{ | |
"_source": ["access", "links", "key_phrases", "article_content"] | |
} | |
GET dev_wiki_elser/_search | |
{ | |
"_source": ["access", "links", "key_phrases", "passages.text"] | |
} | |
GET dev_wiki_elser/_count | |
# Create a role with access level "access": "public" and field access of all fields except access, passages.model_id.keyword, passages.model_id, passages.is_truncated attributes for the index dev_wiki_elser. | |
DELETE /_security/role/public_doc_demo | |
POST /_security/role/public_doc_demo | |
{ | |
"indices": [ | |
{ | |
"names": [ "dev_wiki_elser" ], | |
"privileges": [ "read", "view_index_metadata" ], | |
"field_security" : { | |
"grant" : [ "*"], | |
"except": [ "passages.model_id.keyword", "access", "passages.model_id", "passages.is_truncated" ] | |
}, | |
"query": "{\"term\": {\"access\": \"public\"}}" | |
} | |
] | |
} | |
# Add user sherry to the role. | |
DELETE /_security/user/sherry | |
POST /_security/user/sherry | |
{ | |
"password" : "my_password", | |
"roles" : [ "public_doc_demo" ], | |
"full_name" : "Sherry Ger", | |
"email" : "sherry@elastic.co" | |
} | |
### To query for the number of documents in the index dev_wiki_elser that are visible to the user sherry | |
# curl -X GET -u sherry:my_password https://myspecialcluster.es.us-west1.gcp.cloud.es.io/dev_wiki_elser/_count?pretty | |
### To query for the fields in the index dev_wiki_elser that are visible for a user | |
# curl -X GET -u sherry:my_password https://myspecialcluster.es.us-west1.gcp.cloud.es.io/dev_wiki_elser/_mapping?pretty | |
# Search with new retriever | |
# "explain": true, | |
# Retriever - Search using just text expansion | |
# "explain": true, add if you want to see the math | |
GET dev_wiki_elser/_search | |
{ | |
"_source": "false", | |
"fields": [ | |
"summary", | |
"links", | |
"key_phrases" | |
], | |
"retriever": { | |
"standard": { | |
"query": { | |
"nested": { | |
"path": "passages", | |
"score_mode": "max", | |
"query": { | |
"text_expansion": { | |
"passages.passage_tokens": { | |
"model_id": ".elser_model_2_linux-x86_64", | |
"model_text": "How to configure traffic filter rule set private link google" | |
} | |
} | |
}, | |
"inner_hits": { | |
"size": 1, | |
"_source": false, | |
"fields": [ | |
"passages.text" | |
] | |
} | |
} | |
} | |
} | |
} | |
} | |
# (Legacy Syntax - Search using just text expansion) | |
GET dev_wiki_elser/_search | |
{ | |
"_source": "false", | |
"fields": [ | |
"summary", | |
"links" | |
], | |
"query": { | |
"nested": { | |
"path": "passages", | |
"score_mode": "max", | |
"query": { | |
"text_expansion": { | |
"passages.passage_tokens": { | |
"model_id": ".elser_model_2_linux-x86_64", | |
"model_text": "How to configure traffic filter rule set private link google" | |
} | |
} | |
}, | |
"inner_hits": { | |
"size": 1, | |
"_source": false, | |
"fields": [ | |
"passages.text" | |
] | |
} | |
} | |
} | |
} | |
# RETRIEVER Search with text expansion with pre-filtering | |
# "explain": true, add if you want to see the math | |
GET dev_wiki_elser/_search/ | |
{ | |
"_source": "false", | |
"fields": [ | |
"summary", | |
"links", | |
"key_phrases" | |
], | |
"retriever": { | |
"standard": { | |
"query": { | |
"bool": { | |
"should": [ | |
{ | |
"nested": { | |
"path": "passages", | |
"score_mode": "max", | |
"query": { | |
"text_expansion": { | |
"passages.passage_tokens": { | |
"model_id": ".elser_model_2_linux-x86_64", | |
"model_text": "How to configure traffic filter rule set private link google" | |
} | |
} | |
}, | |
"inner_hits": { | |
"size": 1, | |
"_source": false, | |
"fields": [ | |
"passages.text" | |
] | |
} | |
} | |
}, | |
{ | |
"match": { | |
"key_phrases": "How to configure traffic filter rule set private link google" | |
} | |
} | |
] | |
} | |
} | |
} | |
} | |
} | |
# # (Legacy Syntax - Search with text expansion with pre-filtering) | |
GET dev_wiki_elser/_search | |
{ | |
"_source": "false", | |
"fields": [ | |
"summary", | |
"links" | |
], | |
"query": { | |
"bool": { | |
"should": [ | |
{ | |
"nested": { | |
"path": "passages", | |
"score_mode": "max", | |
"query": { | |
"text_expansion": { | |
"passages.passage_tokens": { | |
"model_id": ".elser_model_2_linux-x86_64", | |
"model_text": "How to configure traffic filter rule set private link google" | |
} | |
} | |
}, | |
"inner_hits": { | |
"size": 1, | |
"_source": false, | |
"fields": [ | |
"passages.text" | |
] | |
} | |
} | |
}, | |
{ | |
"match": { | |
"key_phrases": "How to configure traffic filter rule set private link google" | |
} | |
} | |
] | |
} | |
} | |
} | |
# RETRIEVER with RRF | |
# https://www.elastic.co/guide/en/elasticsearch/reference/current/rrf.html | |
GET dev_wiki_elser/_search | |
{ | |
"size": 3, | |
"_source": "false", | |
"fields": [ | |
"summary", | |
"links", | |
"key_phrases" | |
], | |
"retriever": { | |
"rrf": { | |
"retrievers": [ | |
{ | |
"standard": { | |
"query": { | |
"nested": { | |
"path": "passages", | |
"score_mode": "max", | |
"query": { | |
"text_expansion": { | |
"passages.passage_tokens": { | |
"model_id": ".elser_model_2_linux-x86_64", | |
"model_text": "How to configure traffic filter rule set private link Google" | |
} | |
} | |
}, | |
"inner_hits": { | |
"size": 1, | |
"_source": false, | |
"fields": [ | |
"passages.text" | |
] | |
} | |
} | |
} | |
} | |
}, | |
{ | |
"standard": { | |
"query": { | |
"match": { | |
"key_phrases": "How to configure traffic filter rule set private link Google" | |
} | |
} | |
} | |
} | |
], | |
"window_size": 3, | |
"rank_constant": 1 | |
} | |
} | |
} | |
###################################################################################################### | |
### END | |
###################################################################################################### |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment