

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

# openCypher クエリタイムアウトヒント
<a name="opencypher-query-hints-timeout-hint"></a>

 クエリタイムアウト動作は、クエリレベルのクエリヒント によってクエリごとに設定できます`QUERY:TIMEOUTMILLISECONDS`。`USING` 句とともに使用する必要があります。クエリヒントは、負以外の を値として受け入れます。

------
#### [ AWS CLI ]

```
aws neptunedata execute-open-cypher-query \
  --endpoint-url https://{{your-neptune-endpoint}}:{{port}} \
  --open-cypher-query "USING QUERY:TIMEOUTMILLISECONDS 100 MATCH(n) RETURN n LIMIT 1"
```

詳細については、 コマンドリファレンスの [execute-open-cypher-query](https://docs.aws.amazon.com/cli/latest/reference/neptunedata/execute-open-cypher-query.html) AWS CLI を参照してください。

------
#### [ SDK ]

```
import boto3
from botocore.config import Config

client = boto3.client(
    'neptunedata',
    endpoint_url='https://{{your-neptune-endpoint}}:{{port}}',
    config=Config(read_timeout=None, retries={'total_max_attempts': 1})
)

response = client.execute_open_cypher_query(
    openCypherQuery='USING QUERY:TIMEOUTMILLISECONDS 100 MATCH(n) RETURN n LIMIT 1'
)

print(response['results'])
```

他の言語の AWS SDK の例については、「」を参照してください[AWS SDK](access-graph-opencypher-sdk.md)。

------
#### [ awscurl ]

```
awscurl https://{{your-neptune-endpoint}}:{{port}}/openCypher \
  --region {{us-east-1}} \
  --service neptune-db \
  -X POST \
  -d "query=USING QUERY:TIMEOUTMILLISECONDS 100 MATCH(n) RETURN n LIMIT 1"
```

**注記**  
この例では、 AWS 認証情報が 環境で設定されていることを前提としています。{{us-east-1}} を Neptune クラスターのリージョンに置き換えます。

------
#### [ curl ]

```
curl https://{{your-neptune-endpoint}}:{{port}}/openCypher \
  -d "query=USING QUERY:TIMEOUTMILLISECONDS 100 MATCH(n) RETURN n LIMIT 1"
```

------

 クエリタイムアウトの動作では、クラスターレベルのタイムアウトとクエリレベルのタイムアウトの最小値が考慮されます。クエリタイムアウトの動作については、以下の例を参照してください。クラスターレベルのクエリタイムアウトの詳細については、[「neptune\_query\_timeout](https://docs.aws.amazon.com/neptune/latest/userguide/parameters.html#parameters-db-cluster-parameters-neptune_query_timeout)」を参照してください。

```
# Suppose `neptune_query_timeout` is 10000 ms and query-level timeout is set to 100 ms
# It will consider 100 ms as the final timeout 

curl https://{{your-neptune-endpoint}}:{{port}}/openCypher \
  -d "query=USING QUERY:TIMEOUTMILLISECONDS 100 MATCH(n) RETURN n LIMIT 1"

# Suppose `neptune_query_timeout` is 100 ms and query-level timeout is set to 10000 ms
# It will still consider 100 ms as the final timeout 

curl https://{{your-neptune-endpoint}}:{{port}}/openCypher \
  -d "query=USING QUERY:TIMEOUTMILLISECONDS 10000 MATCH(n) RETURN n LIMIT 1"
```

クエリがタイムアウトを超えると、Neptune はクエリを終了し、タイムアウトエラーを返します。タイムアウトしたクエリを再試行するかどうかは、障害の性質とワークロードによって異なります。ガイダンスについては、「[例外処理と再試行](transactions-exceptions.md)」を参照してください。