Repository: milvus-io/pymilvus

Issue:
[Bug]: It seems pymilvus==2.2.14 have bug with alter_collection
### Is there an existing issue for this?

- [X] I have searched the existing issues

### Describe the bug

See: https://github.com/matrixji/milvus-lite/actions/runs/5653197188/job/15314820137
```
collection created: demo
Traceback (most recent call last):
  File "/github/home/.local/lib/python3.10/site-packages/pymilvus/decorators.py", line 123, in handler
    return func(*args, **kwargs)
  File "/github/home/.local/lib/python3.10/site-packages/pymilvus/decorators.py", line 162, in handler
    return func(self, *args, **kwargs)
  File "/github/home/.local/lib/python3.10/site-packages/pymilvus/decorators.py", line [104](https://github.com/matrixji/milvus-lite/actions/runs/5653197188/job/15314820137#step:6:105), in handler
    raise e from e
  File "/github/home/.local/lib/python3.10/site-packages/pymilvus/decorators.py", line 68, in handler
    return func(*args, **kwargs)
  File "/github/home/.local/lib/python3.10/site-packages/pymilvus/client/grpc_handler.py", line 308, in alter_collection
    request = Prepare.alter_collection_request(collection_name, properties)
  File "/github/home/.local/lib/python3.10/site-packages/pymilvus/client/prepare.py", line 236, in alter_collection_request
    kvs = [common_types.KeyDataPair(key=k, value=str(v)) for k, v in properties.items()]
  File "/github/home/.local/lib/python3.10/site-packages/pymilvus/client/prepare.py", line 236, in <listcomp>
    kvs = [common_types.KeyDataPair(key=k, value=str(v)) for k, v in properties.items()]
ValueError: Protocol message KeyDataPair has no "value" field.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/__w/milvus-lite/milvus-lite/examples/example.py", line 188, in <module>
    main()
  File "/__w/milvus-lite/milvus-lite/examples/example.py", line 156, in main
    set_properties(collection)
  File "/__w/milvus-lite/milvus-lite/examples/example.py", line 141, in set_properties
    collection.set_properties(properties={"collection.ttl.seconds": 1800})
  File "/github/home/.local/lib/python3.10/site-packages/pymilvus/orm/collection.py", line 358, in set_properties
    conn.alter_collection(
  File "/github/home/.local/lib/python3.10/site-packages/pymilvus/decorators.py", line 145, in handler
    raise MilvusException(message=f"Unexpected error, message=<{e!s}>") from e
pymilvus.exceptions.MilvusException: <MilvusException: (code=1, message=Unexpected error, message=<Protocol message KeyDataPair has no "value" field.>)>
Error: Process completed with exit code 1.
```

the root cause is KeyDataPair only have `data` field but not the `value`

### Expected Behavior

Hope could run example.py from pymilvus.

### Steps/Code To Reproduce behavior

```markdown
See above
```


### Environment details

```markdown
- Hardware/Softward conditions (OS, CPU, GPU, Memory): N/A
- Method of installation (Docker, or from source): pip
- Milvus version (v0.3.1, or v0.4.0): 2.2.12
- Milvus configuration (Settings you made in `server_config.yaml`): N/A
```


### Anything else?

_No response_

Discussion:
sre-ci-robot: [APPROVALNOTIFIER] This PR is **NOT APPROVED**

This pull-request has been approved by: *<a href="https://github.com/milvus-io/pymilvus/pull/1624#" title="Author self-approved">matrixji</a>*
To complete the [pull request process](https://git.k8s.io/community/contributors/guide/owners.md#the-code-review-process), please assign **longjiquan** after the PR has been reviewed.
You can assign the PR to them by writing `/assign @longjiquan` in a comment when ready.

The full list of commands accepted by this bot can be found [here](https://go.k8s.io/bot-commands?repo=milvus-io%2Fpymilvus).

<details open>
Needs approval from an approver in each of these files:

- **[OWNERS](https://github.com/milvus-io/pymilvus/blob/master/OWNERS)**

Approvers can indicate their approval by writing `/approve` in a comment
Approvers can cancel approval by writing `/approve cancel` in a comment
</details>
<!-- META={"approvers":["longjiquan"]} -->
matrixji: /cc @XuanYang-cn 
XuanYang-cn: /lgtm
/approve
sre-ci-robot: [APPROVALNOTIFIER] This PR is **APPROVED**

This pull-request has been approved by: *<a href="https://github.com/milvus-io/pymilvus/pull/1624#" title="Author self-approved">matrixji</a>*, *<a href="https://github.com/milvus-io/pymilvus/pull/1624#issuecomment-1657507678" title="Approved">XuanYang-cn</a>*

The full list of commands accepted by this bot can be found [here](https://go.k8s.io/bot-commands?repo=milvus-io%2Fpymilvus).

The pull request process is described [here](https://git.k8s.io/community/contributors/guide/owners.md#the-code-review-process)

<details >
Needs approval from an approver in each of these files:

- ~~[OWNERS](https://github.com/milvus-io/pymilvus/blob/master/OWNERS)~~ [XuanYang-cn]

Approvers can indicate their approval by writing `/approve` in a comment
Approvers can cancel approval by writing `/approve cancel` in a comment
</details>
<!-- META={"approvers":[]} -->

Patch:
diff --git a/pymilvus/client/prepare.py b/pymilvus/client/prepare.py
index f6b4ca22..6e034617 100644
--- a/pymilvus/client/prepare.py
+++ b/pymilvus/client/prepare.py
@@ -234,7 +234,7 @@ class Prepare:
         collection_name: str,
         properties: Dict,
     ) -> milvus_types.AlterCollectionRequest:
-        kvs = [common_types.KeyDataPair(key=k, value=str(v)) for k, v in properties.items()]
+        kvs = [common_types.KeyValuePair(key=k, value=str(v)) for k, v in properties.items()]
 
         return milvus_types.AlterCollectionRequest(collection_name=collection_name, properties=kvs)
 


Test patch:
diff --git a/tests/test_prepare.py b/tests/test_prepare.py
index acb2e193..f696de57 100644
--- a/tests/test_prepare.py
+++ b/tests/test_prepare.py
@@ -180,3 +180,8 @@ class TestCreateCollectionRequest:
 
         Prepare.row_insert_param("", rows, "", fields_info=schema.to_dict()["fields"], enable_dynamic=True)
 
+
+class TestAlterCollectionRequest:
+    def test_alter_collection_request(self):
+        schema = Prepare.alter_collection_request('foo', {'collection.ttl.seconds': 1800})
+