2.0.3 • Published 9 years ago

humane-indexer v2.0.3

Weekly downloads
2
License
LGPL
Repository
github
Last release
9 years ago

humane-indexer

APIs

Note:

  • Indexer APIs are available at: http://<server-url>/:instanceName/indexer/api.
  • All types must be valid index types defined in configuration.
  • BODY must be valid JSON.
  • All requests shall have Content-Type header as: Content-Type: application/json

Add

This method adds document of given type.

Method 1
  • TYPE : POST

  • URL : /add

  • BODY : {type: <type>, doc: <data>}

  • SUCCESS RESPONSE :

    • Http Status Code: 200 or 201

    • Sample Response Body :

      {
        "_id": "18473",
        "_type": "abcType",
        "_index": "xyzIndex",
        "_version": 5,
        "_statusCode": 201,
        "_status": "SUCCESS",
        "_operation": "ADD",
        "serviceTimeTaken": "127.377"
      }
  • ERROR RESPONSES : See Common Error Scenarios

    • Case: Document already exists

      • Http Status Code: 404

      • Sample Response Body :

        {
          "_id": "18473",
          "_type": "abcType",
          "_index": "xyzIndex",
          "_statusCode": 404,
          "_status": "FAIL",
          "_failCode": "EXISTS_ALREADY",
          "_operation": "ADD",
          "serviceTimeTaken": "70.075"
        }
    • See Common Error Scenarios

Method 2
  • TYPE : PUT

  • URL : /:type

  • BODY : {doc: <data>}

  • SUCCESS RESPONSE : Same as method 1

  • ERROR RESPONSES : Same as method 1

Full Update

This method does full update of document of given type and id.

Method 1
  • TYPE : POST

  • URL : /update

  • BODY : {type: <type>, id: <id>, doc: <data>}

  • SUCCESS RESPONSE :

    • Http Status Code: 200

    • Sample Response Body :

      {
        "_id": "18473",
        "_type": "abcType",
        "_index": "xyzIndex",
        "_version": 1,
        "_statusCode": 200,
        "_status": "SUCCESS",
        "_operation": "UPDATE",
        "serviceTimeTaken": "255.350"
      }
  • ERROR RESPONSES :

    • Case: Not found ID

      • Http Status Code: 404

      • Sample Response Body :

        {
          "_id": "18473",
          "_type": "abcType",
          "_index": "xyzIndex",
          "_statusCode": 404,
          "_status": "FAIL",
          "_failCode": "NOT_FOUND",
          "_operation": "UPDATE",
          "serviceTimeTaken": "70.075"
        }
    • See Common Error Scenarios

Method 2
  • TYPE : POST

  • URL : /:type/:id

  • BODY : {doc: <data>}

  • SUCCESS RESPONSE : Same as method 1

  • ERROR RESPONSES : Same as method 1

Merge

This method merges given data with existing data of given type and id.

  • TYPE : POST

  • URL : /merge

  • BODY : {type: <type>, id: <id>, doc: <data>}

  • SUCCESS RESPONSE :

    • Http Status Code: 200

    • Sample Response Body :

      {
        "_id": "18473",
        "_type": "abcType",
        "_index": "xyzIndex",
        "_version": 1,
        "_statusCode": 200,
        "_status": "SUCCESS",
        "_operation": "PARTIAL_UPDATE",
        "serviceTimeTaken": "133.818"
      }
  • ERROR RESPONSES :

    • Case: Not found ID

      • Http Status Code: 404

      • Sample Response Body :

        {
          "_id": "18479",
          "_type": "abcType",
          "_index": "xyzIndex",
          "_statusCode": 404,
          "_status": "FAIL",
          "_failCode": "NOT_FOUND",
          "_operation": "MERGE",
          "serviceTimeTaken": "16.548"
        }
    • See Common Error Scenarios

Upsert

This method adds data of given type if it does not exist, else makes full update.

Method 1
  • TYPE : POST

  • URL : /upsert

  • BODY : {type: <type>, doc: <data>}

  • SUCCESS RESPONSE : For new document: add response, for existing document: update response

  • ERROR RESPONSES : See Common Error Scenarios

Method 2
  • TYPE : POST

  • URL : /:type

  • BODY : {doc: <data>}

  • SUCCESS RESPONSE : Same as method 1

  • ERROR RESPONSES : Same as method 1

Remove

This method removes document of given type and id.

Method 1
  • TYPE : POST

  • URL : /remove

  • BODY : {type: <type>, id: <id>}

  • SUCCESS RESPONSE :

    • Http Status Code: 200

    • Sample Response Body :

      {
        "_id": "18473",
        "_type": "abcType",
        "_index": "xyzIndex",
        "_version": 4,
        "found": true,
        "_statusCode": 200,
        "_status": "SUCCESS",
        "_operation": "REMOVE",
        "serviceTimeTaken": "122.236"
      }
  • ERROR RESPONSES :

    • Case: Not found ID

      • Http Status Code: 404

      • Sample Response Body :

        {
          "_id": "18473",
          "_type": "abcType",
          "_index": "xyzIndex",
          "_statusCode": 404,
          "_status": "FAIL",
          "_operation": "REMOVE",
          "_failCode": "NOT_FOUND",
          "serviceTimeTaken": "84.184"
        }
    • See Common Error Scenarios

Method 2
  • Type : DELETE

  • URL : /:type/:id

  • SUCCESS RESPONSE : Same as method 1

  • ERROR RESPONSES : Same as method 1

Common Error Scenarios

  • Case: Undefined Type - when type is not specified

    • Http Status Code: 400

    • Sample Response Body :

      {
        "_statusCode": 400,
        "_errorCode": "VALIDATION_ERROR",
        "_status": "ERROR",
        "details": {
          "code": "UNDEFINED_TYPE"
        },
        "_errorId": 1458790949474
      }
  • Case: Unrecognized Type - when type is not among the configured

    • Http Status Code: 400

    • Sample Response Body :

      {
        "_statusCode": 400,
        "_errorCode": "VALIDATION_ERROR",
        "_status": "ERROR",
        "details": {
          "code": "UNRECOGNIZED_TYPE",
          "type": "XYZ"
        },
        "_errorId": 1458790974877
      }
  • Case: Undefined ID - when ID is not specified or can not be calculated

    • Http Status Code: 400

    • Sample Response Body :

      {
        "_statusCode": 400,
        "_errorCode": "VALIDATION_ERROR",
        "_status": "ERROR",
        "details": {
          "code": "UNDEFINED_ID"
        },
        "_errorId": 1458748607506
      }
  • Case: Internal Service Error - when there is some internal service error

    • Http Status Code: 500

    • Sample Response Body :

      {
        "_statusCode": 500,
        "_errorCode": "INTERNAL_SERVICE_ERROR",
        "_status": "ERROR",
        "_errorId": 1458819775194
      }
2.0.3

9 years ago

2.0.2

9 years ago

2.0.1

9 years ago

2.0.0

9 years ago

1.12.5

9 years ago

1.12.4

9 years ago

1.12.3

9 years ago

1.12.2

9 years ago

1.12.1

9 years ago

1.12.0

9 years ago

1.11.0

9 years ago

1.10.1

9 years ago

1.9.5

9 years ago

1.9.4

9 years ago

1.9.3

9 years ago

1.9.2

9 years ago

1.9.1

9 years ago

1.9.0

9 years ago

1.8.3

9 years ago

1.8.2

9 years ago

1.8.1

9 years ago

1.8.0

9 years ago

1.7.2

9 years ago

1.7.1

9 years ago

1.7.0

9 years ago

1.6.0

9 years ago

1.5.0

9 years ago

1.4.5

9 years ago

1.4.4

9 years ago

1.4.3

9 years ago

1.4.2

9 years ago

1.4.1

9 years ago

1.4.0

9 years ago

1.3.4

9 years ago

1.3.3

9 years ago

1.3.2

9 years ago

1.3.1

9 years ago

1.3.0

9 years ago

1.2.0

9 years ago

1.1.9

9 years ago

1.1.8

10 years ago

1.1.7

10 years ago

1.1.6

10 years ago

1.1.5

10 years ago

1.1.4

10 years ago

1.1.3

10 years ago

1.1.2

10 years ago

1.1.1

10 years ago

1.1.0

10 years ago

1.0.10

10 years ago

1.0.9

10 years ago

1.0.8

10 years ago

1.0.7

10 years ago

1.0.6

10 years ago

1.0.5

10 years ago