Baoyuantop commented on code in PR #12445:
URL: https://github.com/apache/apisix/pull/12445#discussion_r2331934894


##########
docs/en/latest/discovery/nacos.md:
##########
@@ -278,3 +279,52 @@ The formatted response as below:
   }
 }
 ```
+
+#### Metadata filtering
+
+APISIX supports filtering service instances based on metadata. When a route is 
configured with metadata conditions, only service instances whose metadata 
contains all the key-value pairs specified in the route's `metadata` 
configuration will be selected. The metadata values in the route configuration 
are arrays, and a service instance matches if its metadata value equals any 
value in the corresponding array.
+
+Example: If a service instance has metadata `{lane: "a", env: "prod", version: 
"1.0"}`, it will match routes configured with metadata `{lane: ["a"]}` or 
`{lane: ["a"], env: ["prod"]}`, but not routes configured with `{lane: ["b"]}` 
or `{lane: ["a"], region: ["us"]}`.
+
+Example of routing a request with metadata filtering:
+
+```shell
+$ curl http://127.0.0.1:9180/apisix/admin/routes/5 -H "X-API-KEY: $admin_key" 
-X PUT -i -d '
+{
+    "uri": "/nacosWithMetadata/*",
+    "upstream": {
+        "service_name": "APISIX-NACOS",
+        "type": "roundrobin",
+        "discovery_type": "nacos",
+        "discovery_args": {
+          "metadata": {
+            "version": ["v1"]

Review Comment:
   Hi @beardnick, please take a look.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to