Home / Documentation / REST APIs / Models API

Models API

Get all entity models

GET _zentity/models

Returns all entity models from the .zentity-models index.

URL Params

Param Type Default Required Description
pretty Boolean false No Indents the JSON response data.

Get an entity model

GET _zentity/models/{entity_type}

Returns the entity model for a given entity_type from the .zentity-models index.

URL Params

Param Type Default Required Description
entity_type String Yes Entity type.
pretty Boolean false No Indents the JSON response data.

Create an entity model

Creates an entity model for a given entity_type and puts it in the .zentity-models index. Returns an error if an entity model already exists for that entity_type.

For more details about the contents of the payload, read the entity model specification.

POST _zentity/models/{entity_type}
{
  "attributes": {
    ATTRIBUTE_NAME: {
      "type": ATTRIBUTE_TYPE,
      "params": {
        PARAM_NAME: PARAM_VALUE,
        ...
      }
    },
    ...
  },
  "resolvers": {
    RESOLVER_NAME: {
      "attributes": [
        ATTRIBUTE_NAME,
        ...
      ]
    }
    ...
  },
  "matchers": {
    MATCHER_NAME: {
      "clause": MATCHER_CLAUSE,
      "params": {
        PARAM_NAME: PARAM_VALUE,
        ...
      }
    },
    ...
  },
  "indices": {
    INDEX_NAME: {
      "fields": {
        INDEX_FIELD_NAME: {
          "attribute": ATTRIBUTE_NAME,
          "matcher": MATCHER_NAME
        },
        ...
      }
    },
    ...
  }
}

URL Params

Param Type Default Required Description
entity_type String Yes Entity type.
pretty Boolean false No Indents the JSON response data.

Update an entity model

Updates an entity model for a given entity_type. Creates the entity model if it does not already exist.

For more details about the contents of the payload, read the entity model specification.

PUT _zentity/models/{entity_type}
{
  "attributes": {
    ATTRIBUTE_NAME: {
      "type": ATTRIBUTE_TYPE,
      "params": {
        PARAM_NAME: PARAM_VALUE,
        ...
      }
    },
    ...
  },
  "resolvers": {
    RESOLVER_NAME: {
      "attributes": [
        ATTRIBUTE_NAME,
        ...
      ]
    }
    ...
  },
  "matchers": {
    MATCHER_NAME: {
      "clause": MATCHER_CLAUSE,
      "params": {
        PARAM_NAME: PARAM_VALUE,
        ...
      }
    },
    ...
  },
  "indices": {
    INDEX_NAME: {
      "fields": {
        INDEX_FIELD_NAME: {
          "attribute": ATTRIBUTE_NAME,
          "matcher": MATCHER_NAME
        },
        ...
      }
    },
    ...
  }
}

URL Params

Param Type Default Required Description
entity_type String Yes Entity type.
pretty Boolean false No Indents the JSON response data.

Delete an entity model

Deletes the entity model for a given entity_type from the .zentity-models index.

DELETE _zentity/models/{entity_type}

URL Params

Param Type Default Required Description
entity_type String Yes Entity type.
pretty Boolean false No Indents the JSON response data.

 


Continue Reading

Setup API Resolution API
© 2018 Dave Moore.
Licensed under the Apache License, Version 2.0.
Elasticsearch is a trademark of Elasticsearch BV.
This website uses Google Analytics.