Reference documentation and code samples for the Discovery Engine V1BETA API class Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::SessionSpec.
Session specification.
Multi-turn Search feature is currently at private GA stage. Please use
v1alpha or v1beta version instead before we launch this feature to public
GA. Or ask for allowlisting through Google Support team.
Inherits
Object
Extended By
Google::Protobuf::MessageExts::ClassMethods
Includes
Google::Protobuf::MessageExts
Methods
#query_id
defquery_id()->::String
Returns
(::String) — If set, the search result gets stored to the "turn" specified by this
query ID.
Example: Let's say the session looks like this:
session {
name: ".../sessions/xxx"
turns {
query { text: "What is foo?" query_id: ".../questions/yyy" }
answer: "Foo is ..."
}
turns {
query { text: "How about bar then?" query_id: ".../questions/zzz" }
}
}
The user can call /search API with a request like this:
Then, the API stores the search result, associated with the last turn.
The stored search result can be used by a subsequent /answer API call
(with the session ID and the query ID specified). Also, it is possible
to call /search and /answer in parallel with the same session ID & query
ID.
#query_id=
defquery_id=(value)->::String
Parameter
value (::String) — If set, the search result gets stored to the "turn" specified by this
query ID.
Example: Let's say the session looks like this:
session {
name: ".../sessions/xxx"
turns {
query { text: "What is foo?" query_id: ".../questions/yyy" }
answer: "Foo is ..."
}
turns {
query { text: "How about bar then?" query_id: ".../questions/zzz" }
}
}
The user can call /search API with a request like this:
Then, the API stores the search result, associated with the last turn.
The stored search result can be used by a subsequent /answer API call
(with the session ID and the query ID specified). Also, it is possible
to call /search and /answer in parallel with the same session ID & query
ID.
Returns
(::String) — If set, the search result gets stored to the "turn" specified by this
query ID.
Example: Let's say the session looks like this:
session {
name: ".../sessions/xxx"
turns {
query { text: "What is foo?" query_id: ".../questions/yyy" }
answer: "Foo is ..."
}
turns {
query { text: "How about bar then?" query_id: ".../questions/zzz" }
}
}
The user can call /search API with a request like this:
Then, the API stores the search result, associated with the last turn.
The stored search result can be used by a subsequent /answer API call
(with the session ID and the query ID specified). Also, it is possible
to call /search and /answer in parallel with the same session ID & query
ID.
#search_result_persistence_count
defsearch_result_persistence_count()->::Integer
Returns
(::Integer) — The number of top search results to persist. The persisted search results
can be used for the subsequent /answer api call.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# Discovery Engine V1BETA API - Class Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::SessionSpec (v0.21.0)\n\nVersion latestkeyboard_arrow_down\n\n- [0.21.0 (latest)](/ruby/docs/reference/google-cloud-discovery_engine-v1beta/latest/Google-Cloud-DiscoveryEngine-V1beta-SearchRequest-SessionSpec)\n- [0.20.1](/ruby/docs/reference/google-cloud-discovery_engine-v1beta/0.20.1/Google-Cloud-DiscoveryEngine-V1beta-SearchRequest-SessionSpec)\n- [0.19.1](/ruby/docs/reference/google-cloud-discovery_engine-v1beta/0.19.1/Google-Cloud-DiscoveryEngine-V1beta-SearchRequest-SessionSpec)\n- [0.18.0](/ruby/docs/reference/google-cloud-discovery_engine-v1beta/0.18.0/Google-Cloud-DiscoveryEngine-V1beta-SearchRequest-SessionSpec)\n- [0.17.0](/ruby/docs/reference/google-cloud-discovery_engine-v1beta/0.17.0/Google-Cloud-DiscoveryEngine-V1beta-SearchRequest-SessionSpec)\n- [0.16.0](/ruby/docs/reference/google-cloud-discovery_engine-v1beta/0.16.0/Google-Cloud-DiscoveryEngine-V1beta-SearchRequest-SessionSpec)\n- [0.15.0](/ruby/docs/reference/google-cloud-discovery_engine-v1beta/0.15.0/Google-Cloud-DiscoveryEngine-V1beta-SearchRequest-SessionSpec)\n- [0.14.2](/ruby/docs/reference/google-cloud-discovery_engine-v1beta/0.14.2/Google-Cloud-DiscoveryEngine-V1beta-SearchRequest-SessionSpec)\n- [0.13.0](/ruby/docs/reference/google-cloud-discovery_engine-v1beta/0.13.0/Google-Cloud-DiscoveryEngine-V1beta-SearchRequest-SessionSpec)\n- [0.12.0](/ruby/docs/reference/google-cloud-discovery_engine-v1beta/0.12.0/Google-Cloud-DiscoveryEngine-V1beta-SearchRequest-SessionSpec)\n- [0.11.0](/ruby/docs/reference/google-cloud-discovery_engine-v1beta/0.11.0/Google-Cloud-DiscoveryEngine-V1beta-SearchRequest-SessionSpec)\n- [0.10.0](/ruby/docs/reference/google-cloud-discovery_engine-v1beta/0.10.0/Google-Cloud-DiscoveryEngine-V1beta-SearchRequest-SessionSpec)\n- [0.9.0](/ruby/docs/reference/google-cloud-discovery_engine-v1beta/0.9.0/Google-Cloud-DiscoveryEngine-V1beta-SearchRequest-SessionSpec)\n- [0.8.0](/ruby/docs/reference/google-cloud-discovery_engine-v1beta/0.8.0/Google-Cloud-DiscoveryEngine-V1beta-SearchRequest-SessionSpec)\n- [0.7.2](/ruby/docs/reference/google-cloud-discovery_engine-v1beta/0.7.2/Google-Cloud-DiscoveryEngine-V1beta-SearchRequest-SessionSpec)\n- [0.6.0](/ruby/docs/reference/google-cloud-discovery_engine-v1beta/0.6.0/Google-Cloud-DiscoveryEngine-V1beta-SearchRequest-SessionSpec)\n- [0.5.0](/ruby/docs/reference/google-cloud-discovery_engine-v1beta/0.5.0/Google-Cloud-DiscoveryEngine-V1beta-SearchRequest-SessionSpec)\n- [0.4.0](/ruby/docs/reference/google-cloud-discovery_engine-v1beta/0.4.0/Google-Cloud-DiscoveryEngine-V1beta-SearchRequest-SessionSpec)\n- [0.3.0](/ruby/docs/reference/google-cloud-discovery_engine-v1beta/0.3.0/Google-Cloud-DiscoveryEngine-V1beta-SearchRequest-SessionSpec)\n- [0.2.1](/ruby/docs/reference/google-cloud-discovery_engine-v1beta/0.2.1/Google-Cloud-DiscoveryEngine-V1beta-SearchRequest-SessionSpec)\n- [0.1.0](/ruby/docs/reference/google-cloud-discovery_engine-v1beta/0.1.0/Google-Cloud-DiscoveryEngine-V1beta-SearchRequest-SessionSpec) \nReference documentation and code samples for the Discovery Engine V1BETA API class Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::SessionSpec.\n\nSession specification.\n\n\n\u003cbr /\u003e\n\nMulti-turn Search feature is currently at private GA stage. Please use\nv1alpha or v1beta version instead before we launch this feature to public\nGA. Or ask for allowlisting through Google Support team. \n\nInherits\n--------\n\n- Object \n\nExtended By\n-----------\n\n- Google::Protobuf::MessageExts::ClassMethods \n\nIncludes\n--------\n\n- Google::Protobuf::MessageExts\n\nMethods\n-------\n\n### #query_id\n\n def query_id() -\u003e ::String\n\n**Returns**\n\n- (::String) --- If set, the search result gets stored to the \"turn\" specified by this query ID.\n\n Example: Let's say the session looks like this:\n session {\n name: \".../sessions/xxx\"\n turns {\n query { text: \"What is foo?\" query_id: \".../questions/yyy\" }\n answer: \"Foo is ...\"\n }\n turns {\n query { text: \"How about bar then?\" query_id: \".../questions/zzz\" }\n }\n }\n\n The user can call /search API with a request like this:\n\n session: \".../sessions/xxx\"\n session_spec { query_id: \".../questions/zzz\" }\n\n Then, the API stores the search result, associated with the last turn.\n The stored search result can be used by a subsequent /answer API call\n (with the session ID and the query ID specified). Also, it is possible\n to call /search and /answer in parallel with the same session ID \\& query\n ID.\n\n### #query_id=\n\n def query_id=(value) -\u003e ::String\n\n**Parameter**\n\n- **value** (::String) --- If set, the search result gets stored to the \"turn\" specified by this query ID.\n\n\n Example: Let's say the session looks like this:\n session {\n name: \".../sessions/xxx\"\n turns {\n query { text: \"What is foo?\" query_id: \".../questions/yyy\" }\n answer: \"Foo is ...\"\n }\n turns {\n query { text: \"How about bar then?\" query_id: \".../questions/zzz\" }\n }\n }\n\n The user can call /search API with a request like this:\n\n session: \".../sessions/xxx\"\n session_spec { query_id: \".../questions/zzz\" }\n\n Then, the API stores the search result, associated with the last turn.\n The stored search result can be used by a subsequent /answer API call\n (with the session ID and the query ID specified). Also, it is possible\n to call /search and /answer in parallel with the same session ID \\& query\nID. \n**Returns**\n\n- (::String) --- If set, the search result gets stored to the \"turn\" specified by this query ID.\n\n Example: Let's say the session looks like this:\n session {\n name: \".../sessions/xxx\"\n turns {\n query { text: \"What is foo?\" query_id: \".../questions/yyy\" }\n answer: \"Foo is ...\"\n }\n turns {\n query { text: \"How about bar then?\" query_id: \".../questions/zzz\" }\n }\n }\n\n The user can call /search API with a request like this:\n\n session: \".../sessions/xxx\"\n session_spec { query_id: \".../questions/zzz\" }\n\n Then, the API stores the search result, associated with the last turn.\n The stored search result can be used by a subsequent /answer API call\n (with the session ID and the query ID specified). Also, it is possible\n to call /search and /answer in parallel with the same session ID \\& query\n ID.\n\n### #search_result_persistence_count\n\n def search_result_persistence_count() -\u003e ::Integer\n\n**Returns**\n\n- (::Integer) --- The number of top search results to persist. The persisted search results can be used for the subsequent /answer api call.\n\n This field is simliar to the `summary_result_count` field in\n [SearchRequest.ContentSearchSpec.SummarySpec.summary_result_count](/ruby/docs/reference/google-cloud-discovery_engine-v1beta/latest/Google-Cloud-DiscoveryEngine-V1beta-SearchRequest-ContentSearchSpec-SummarySpec#Google__Cloud__DiscoveryEngine__V1beta__SearchRequest__ContentSearchSpec__SummarySpec_summary_result_count_instance_ \"Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec#summary_result_count (method)\").\n\n At most 10 results for documents mode, or 50 for chunks mode.\n\n### #search_result_persistence_count=\n\n def search_result_persistence_count=(value) -\u003e ::Integer\n\n**Parameter**\n\n- **value** (::Integer) --- The number of top search results to persist. The persisted search results can be used for the subsequent /answer api call.\n\n\n This field is simliar to the `summary_result_count` field in\n [SearchRequest.ContentSearchSpec.SummarySpec.summary_result_count](/ruby/docs/reference/google-cloud-discovery_engine-v1beta/latest/Google-Cloud-DiscoveryEngine-V1beta-SearchRequest-ContentSearchSpec-SummarySpec#Google__Cloud__DiscoveryEngine__V1beta__SearchRequest__ContentSearchSpec__SummarySpec_summary_result_count_instance_ \"Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec#summary_result_count (method)\").\n\nAt most 10 results for documents mode, or 50 for chunks mode. \n**Returns**\n\n- (::Integer) --- The number of top search results to persist. The persisted search results can be used for the subsequent /answer api call.\n\n This field is simliar to the `summary_result_count` field in\n [SearchRequest.ContentSearchSpec.SummarySpec.summary_result_count](/ruby/docs/reference/google-cloud-discovery_engine-v1beta/latest/Google-Cloud-DiscoveryEngine-V1beta-SearchRequest-ContentSearchSpec-SummarySpec#Google__Cloud__DiscoveryEngine__V1beta__SearchRequest__ContentSearchSpec__SummarySpec_summary_result_count_instance_ \"Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec#summary_result_count (method)\").\n\n At most 10 results for documents mode, or 50 for chunks mode."]]