Schema検証
    • PDF

    Schema検証

    • PDF

    記事の要約

    Domain作成をする前にSchemaの検証ができます。 該当リクエストを通じて正しく作成されたSchemaであるかが確認できます。
    インデックス(index)は追加できるが、作成した後に削除は不可能です。

    POST https://cloudsearch.apigw.ntruss.com/CloudSearch/real/v1/schemaValidator
    

    リクエスト

    リクエストボディ

    フィールド名必須タイプ制約事項説明
    documentYesSchema検索設定

    レスポンス

    レスポンスStatus

    HTTP StatusDesc
    200OK(有効なSchema)
    400Bad Request(有効でないSchema)
    401Unauthorized
    403Forbidden
    404Not Found
    500Internal Server Error

    例示

    リクエスト例示 - 有効なSchema

    POST https://cloudsearch.apigw.ntruss.com/CloudSearch/real/v1/schemaValidator
    
    POST /CloudSearch/real/v1/schemaValidator HTTP/1.1
    Host:cloudsearch.apigw.ntruss.com
    accept:application/json
    
    x-ncp-apigw-signature-v2: cDwtHuQeGmwWyNmwlN6XIGA66zge4iMXvfoDQNna05g=
    x-ncp-apigw-timestamp: 1545817618751
    x-ncp-iam-access-key: teGTwtcSEGA7fu28BGGi
    
    {
      "document": {
        "primarySectionName": "name",
        "sections": [
          {
            "docProperties": [
              {
                "type": "string",
                "name": "dp_name"
              }
            ],
            "name": "name"
          },
          {
            "docProperties": [
              {
                "type": "string",
                "name": "dp_phone_number"
              }
            ],
            "name": "phone_number"
          }
        ],
        "indexes": [
          {
            "documentTermWeight": "sum_wgt",
            "buildInfos": [
              {
                "sections": [
                  "name"
                ],
                "sectionTermWeight": "1.0 * stw_2p(tf, 0.5, 0.25, 0., length / 128.0)",
                "indexProcessors": [
                  {
                    "type": "hanaterm",
                    "method": "sgmt",
                    "option": "+korea +josacat +eomicat"
                  }
                ],
                "name": "index_build_0"
              }
            ],
            "name": "name"
          }
        ]
      }
    }
    

    レスポンス例示 - 有効なSchema

    {
      "status": "valid",
      "message": "OK",
      "response": "{\"status\":{\"code\":0,\"message\":\"ok\"}}\n"
    }
    

    リクエスト例示 - 有効でないSchema : JSON Parsingエラー

    POST https://cloudsearch.apigw.ntruss.com/CloudSearch/real/v1/schemaValidator
    
    POST /CloudSearch/real/v1/schemaValidator HTTP/1.1
    Host:cloudsearch.apigw.ntruss.com
    accept:application/json
    
    x-ncp-apigw-signature-v2: cDwtHuQeGmwWyNmwlN6XIGA66zge4iMXvfoDQNna05g=
    x-ncp-apigw-timestamp: 1545817618751
    x-ncp-iam-access-key: teGTwtcSEGA7fu28BGGi
    
    {
      "document": {
       
        "sections": [
          {
            "docProperties": [
              {
                "type": "string",
                "name": "dp_name"
              }
            ],
            "name": "name"
          }
        ]
    
    }
    

    レスポンス例示 - 有効でないSchema : JSON Parsingエラー

    {
      "expose": true,
      "statusCode": 400,
      "status": 400,
      "body": "{\n  \"document\": {\n   \n    \"sections\": [\n      {\n        \"docProperties\": [\n          {\n            \"type\": \"string\",\n            \"name\": \"dp_name\"\n          }\n        ],\n        \"name\": \"name\"\n      }\n    ]\n\n}",
      "type": "entity.parse.failed"
    }
    

    リクエスト例示 - 有効でないSchema : 必須フィールド漏れ

    POST https://cloudsearch.apigw.ntruss.com/CloudSearch/real/v1/schemaValidator
    
    POST /CloudSearch/real/v1/schemaValidator HTTP/1.1
    Host:cloudsearch.apigw.ntruss.com
    accept:application/json
    
    x-ncp-apigw-signature-v2: cDwtHuQeGmwWyNmwlN6XIGA66zge4iMXvfoDQNna05g=
    x-ncp-apigw-timestamp: 1545817618751
    x-ncp-iam-access-key: teGTwtcSEGA7fu28BGGi
    
    {
      "document": {
       
        "sections": [
          {
            "docProperties": [
              {
                "type": "string",
                "name": "dp_name"
              }
            ],
            "name": "name"
          }
        ]
      }
    }
    

    レスポンス- 有効でないSchema : 必須フィールド漏れ

    {
      "0": {
        "keyword": "required",
        "dataPath": ".document",
        "schemaPath": "#/required",
        "params": {
          "missingProperty": "primarySectionName"
        },
        "message": "should have required property 'primarySectionName'"
      },
      "1": {
        "keyword": "required",
        "dataPath": ".document",
        "schemaPath": "#/required",
        "params": {
          "missingProperty": "indexes"
        },
        "message": "should have required property 'indexes'"
      },
      "message": "Bad Request"
    }
    

    この記事は役に立ちましたか?

    What's Next
    Changing your password will log you out immediately. Use the new password to log back in.
    First name must have atleast 2 characters. Numbers and special characters are not allowed.
    Last name must have atleast 1 characters. Numbers and special characters are not allowed.
    Enter a valid email
    Enter a valid password
    Your profile has been successfully updated.