Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Wenn Sie Gesundheitsdaten abfragen, können Sie Filter verwenden, um die Suchergebnisse einzugrenzen. In einer Suchanfrage können Sie Filter angeben, um Kriterien zu erzwingen, die bestimmte Suchantworten ein- oder ausschließen.
Sehen Sie sich die Liste der FHIR R4-Ressourcen an, die von Vertex AI Search als indexierbare, durchsuchbare und abrufbare Felder unterstützt werden.
Weitere Informationen finden Sie in der Referenz zum FHIR R4-Datenschema für das Gesundheitswesen.
Filter werden im Feld filter im Anfragetext der Methode servingConfigs.search angegeben.
Die Filterdefinition folgt der Syntax für Filterausdrücke.
Im Filterausdruck kann das Literal ein beliebiges indexierbares Feld aus der Antwort auf die Suchanfrage sein. Wenn die Antwort beispielsweise eine Beobachtungsressource enthält, kann die patient_id, auf die sich die Beobachtungsressource bezieht, als Filterliteral verwendet werden.
In den folgenden Abschnitten finden Sie einige Beispiele für die Erstellung von Filtern.
resource_datetime-Filter definieren
In diesem Beispiel wird gezeigt, wie Sie einen Filter für eine Suche angeben, die nur Ressourcen mit einem resource_datetime-Wert nach dem angegebenen Datums- und Zeitwert enthält.
Im folgenden Beispiel wird gezeigt, wie Sie einen Filter erstellen, der mit dem Operator AND zuerst alle Composition-Ressourcen und dann diejenigen filtert, deren Datum nach einem bestimmten Datum und einer bestimmten Uhrzeit liegt.
"filter": "resource_type: ANY("Composition") AND Composition.date > "2022-08-05T01:00:00+00:00""
FHIR-Ressourcenfilter definieren
Mit einem Filter können Sie prüfen, ob eine FHIR-Ressource im Vertex AI Search-Datenspeicher vorhanden ist. Sie können beispielsweise mit dem folgenden Filter nach einer DocumentReference-Ressource mit der ID 6112d1ac-c6bd-4755-d689-bfb71d59afc5 suchen.
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-08-19 (UTC)."],[[["\u003cp\u003eGenerative AI services within this platform are restricted from use in clinical settings for direct diagnosis or treatment without a licensed professional's review, although non-clinical administrative tasks are permitted.\u003c/p\u003e\n"],["\u003cp\u003eThe outputs generated by this service, being based on large language models, may contain inaccuracies, biases, or stereotypes, and should always be treated as drafts requiring review.\u003c/p\u003e\n"],["\u003cp\u003eThis tool is intended solely for retrieving and summarizing existing medical information, not for providing advice on the prevention, diagnosis, or treatment of any illness or disease.\u003c/p\u003e\n"],["\u003cp\u003eThe applicability of this product is limited for individuals under 18 and over 85 due to limited testing data, necessitating careful consideration of the source data's subpopulation representation when analyzing results.\u003c/p\u003e\n"],["\u003cp\u003eWhen querying healthcare data, users can utilize filters such as patient ID, date/time, and resource type to refine search responses by including or excluding specific criteria.\u003c/p\u003e\n"]]],[],null,["# Filter healthcare search\n\n| **Caution:**\n|\n| - Restrictions for healthcare: As a customer, you will not, and will not allow End Users to, use the Generative AI Services for clinical purposes (for clarity, non-clinical research, scheduling, or other administrative tasks is not restricted), as a substitute for professional medical advice, or in any manner that is overseen by or requires clearance or approval from any applicable regulatory authority. For more information, see [Service Specific Terms](https://cloud.google.com/terms/service-terms).\n|\n| For clarity, with respect to the use of Vertex AI Search to retrieve and\n| summarize existing medical information, the restriction on the use for clinical\n| purposes means the restriction on the use for direct diagnosis or treatment purposes without review by\n| a licensed professional in compliance with applicable laws and regulations.\n| - The generated output may not always be completely reliable. Due to the nature of LLMs and Generative AI, outputs may have incorrect or biased (for example, stereotypes or other harmful content) information and should be reviewed. All summaries or answers should be considered draft and not final.\n| - This product's intended usage is not to provide information pertaining to the prevention, diagnosis or treatment of illness or disease. Questions regarding diagnosis or treatment recommendations are not intended to be addressed by the product. This product's intended use is to retrieve and summarize existing medical information provided by users.\n| - Due to limited test data, this product may or may not be applicable to age group 0-18 and to age group 85 and above. Therefore, when reviewing the generated output, customers must consider the representativeness of subpopulations within their source data.\n\n\u003cbr /\u003e\n\nWhen you're querying healthcare data, you can use filters to refine your search\nresponses. In a search request, you can provide filters to enforce criteria that\ninclude or exclude certain search responses.\n\nFor example, when you're\n[searching over a single patient's data](/generative-ai-app-builder/docs/search-hc-data), the search request\nbody must contain the following filter expression that specifies the patient ID: \n\n```\n\"filter\": \"patient_id: ANY(\\\"PATIENT_ID\\\")\"\n```\n\nThis page shows you how to define filters for healthcare search.\n\nBefore you begin\n----------------\n\nBefore you begin, do the following:\n\n- Create a healthcare search app and a healthcare search data store, and import FHIR R4 data. For more information, see [Create a healthcare search app](/generative-ai-app-builder/docs/create-app-hc) and [Create a healthcare search data store](/generative-ai-app-builder/docs/create-data-store-hc).\n- Review the list of FHIR R4 resources that Vertex AI Search supports as indexable, searchable, and retrievable fields. For more information, see [Healthcare FHIR R4 data schema reference](/generative-ai-app-builder/docs/fhir-schema-reference).\n- Understand the [filter expression syntax](/generative-ai-app-builder/docs/filter-search-metadata#filter-expression-syntax).\n\nDefine filters\n--------------\n\nFilters are specified in the `filter` field in the request body of the\n[`servingConfigs.search`](/generative-ai-app-builder/docs/reference/rest/v1alpha/projects.locations.collections.dataStores.servingConfigs/search) method.\n\nThe filter definition follows the [filter expression syntax](/generative-ai-app-builder/docs/filter-search-metadata#filter-expression-syntax).\nIn the filter expression, the literal can be any indexable field from the\nresponse to the search query. For example, if the response contains an Observation resource,\nthe `patient_id` that the Observation resource references can be used as a filter\nliteral.\n\nThe following sections show a few examples on how to construct filters.\n\n### Define a `resource_datetime` filter\n\nThis example shows you how to specify a filter for a search that includes only\nthose resources that have a `resource_datetime` value later than the specified date\nand time value. \n\n### REST\n\n```\ncurl -X POST -H \"Authorization: Bearer $(gcloud auth print-access-token)\" \\\n -H \"Content-Type: application/json\" \\\n \"https://us-discoveryengine.googleapis.com/v1alpha/projects/PROJECT_ID/locations/us/collections/default_collection/dataStores/DATA_STORE_ID/servingConfigs/default_search:search\" \\\n -d '{\n\"query\": \"QUERY\",\n\"filter\": \"patient_id: ANY(\\\"PATIENT_ID\\\") AND resource_datetime \u003e \\\"DATE_TIME_VALUE,\n\"contentSearchSpec\":{\"snippetSpec\":{\"returnSnippet\":true}}\n}'\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: the ID of your Google Cloud project.\n- \u003cvar translate=\"no\"\u003eDATA_STORE_ID\u003c/var\u003e: the ID of the Vertex AI Search data store.\n- \u003cvar translate=\"no\"\u003eQUERY\u003c/var\u003e: the search query.\n- \u003cvar translate=\"no\"\u003ePATIENT_ID\u003c/var\u003e: the resource ID of the patient whose data you want to search.\n- \u003cvar translate=\"no\"\u003eDATE_TIME_VALUE\u003c/var\u003e: the value of the `resource_datetime` field that represents a date and time in the FHIR [dateTime](https://build.fhir.org/datatypes.html#dateTime) format. Some examples of this field are as follows:\n - To specify a date and time with a time zone separated by a `T` separator: `2022-08-05T01:00:00+00:00`\n - To specify a date: `2022-08-05`\n - To specify a month: `2022-08`\n - To specify a year: `2022`\n\n#### Response\n\n\nYou should receive a JSON response similar to the following truncated\nresponse. The response contains itemized search results listed in reverse\nchronological order with snippets, if snippets are available. The\n`structData` field contains the structured JSON data for the\ndocument. \n\n```\n{\n \"results\": [\n {\n \"id\": \"DOCUMENT_ID\",\n \"document\": {\n \"name\": \"projects/PROJECT_ID/locations/us/collections/default_collection/dataStores/DATA_STORE_ID/branches/0/documents/DOCUMENT_ID\",\n \"id\": \"DOCUMENT_ID\",\n \"structData\": {\n ...\n \"resource_type\": \"FHIR_RESOURCE_TYPE\",\n \"resource_datetime\": \"RESOURCE_DATETIME\",\n \"patient_id\": \"PATIENT_ID\",\n \"FHIR_RESOURCE_TYPE\": { ... }\n },\n \"derivedStructData\": {\n \"snippets\": [\n {\n \"snippet\": \"SNIPPET_TEXT\",\n \"snippet_status\": \"SUCCESS\"\n }\n ]\n }\n }\n }]\n}\n```\n\n\u003cbr /\u003e\n\n### Define a resource type filter\n\nThe following example shows how to construct a filter that uses an `AND`\noperator to first filter all Composition resources and then filter those whose\ndate is later than a specified date and time. \n\n```\n\"filter\": \"resource_type: ANY(\"Composition\") AND Composition.date \u003e \"2022-08-05T01:00:00+00:00\"\"\n```\n\n### Define a FHIR resource filter\n\nYou can use a filter to check whether a FHIR resource is present in the\nVertex AI Search data store. For example, you can search for a\nDocumentReference resource that has the ID\n`6112d1ac-c6bd-4755-d689-bfb71d59afc5` using the following filter. \n\n```\n\"filter\": \"DocumentReference.id: ANY(\\\"6112d1ac-c6bd-4755-d689-bfb71d59afc5\\\")\"\n```"]]