Retrieve Index Fields

Retrieves the ingested fields for a specified field type or for all field types.

The Retrieve Index Fields API retrieves a list of the fields that have been ingested into a specified text index. The Retrieve Index Fields API also returns the data type of each field.

Quick Start

You can use the Retrieve Index Fields API to inspect a text index and suggest fields for inclusion in the query criteria of APIs such as Query Text Index and Find Related Concepts.

For more information on field types, see Index Field Types.

The API returns fields of all types by default, but you can also filter for specific types of field.

For example, the request below queries a private index called mynewindex for its parametric fields:

/1/api/sync/retrieveindexfields/v2?field_types=parametric&indexes=mynewindex

The response looks like this:

{
  "total_fields": 3,
  "field_type_counts": {
    "parametric_count": 3
  },
  "parametric_type_fields": [
    "author",
    "content_type",
    "source_connector"
  ]
}

If you submit multiple indexes with similar fields, you can choose to keep them in separate lists per index (the default behavior) or combine the returns into a single list for all fields.

The following request is the same as the first, but adds the English news index:

/1/api/sync/retrieveindexfields/v2?field_types=parametric&indexes=news_eng&indexes=mynewindex

The default response shows the parametric fields in each index separately:

{
  "news_eng": {
    "total_fields": 6,
    "field_type_counts": {
      "parametric_count": 6
    },
    "parametric_type_fields": [
      "company",
      "person",
      "place",
      "rss_category",
      "rss_source",
      "rss_url"
    ]
  },
  "mynewindex": {
    "total_fields": 3,
    "field_type_counts": {
      "parametric_count": 3
    },
    "parametric_type_fields": [
      "author",
      "content_type",
      "source_connector"
    ]
  }
}

In the following request, we add the German news index, which has the same parametric fields as the English news index, and combine the results from all three indexes into one list:

/1/api/sync/retrieveindexfields/v2?field_types=parametric&indexes=news_eng&indexes=news_ger&indexes=mynewindex&combine_fields=true
{
  "total_fields": 9,
  "field_type_counts": {
    "parametric_count": 9
  },
  "parametric_type_fields": [
    "author",
    "company",
    "content_type",
    "person",
    "place",
    "rss_category",
    "rss_source",
    "rss_url",
    "source_connector"
  ]
}

Note: the Retrieve Index Fields API returns only fields that exist in documents ingested into a text index; it does not return all fields configured in calls to the Create Text Index API.

Note: Field names in Haven OnDemand are not case sensitive. For example, the TITLE field name is equivalent to Title or title.

Synchronous
https://api.havenondemand.com/1/api/sync/retrieveindexfields/v2
Asynchronous
https://api.havenondemand.com/1/api/async/retrieveindexfields/v2
Authentication

This API requires an authentication token to be supplied in the following parameter:

Parameter Description
apikey The API key to use to authenticate the API request.
Parameters

This API accepts the following parameters:

Optional
Name Type Description
field_types
array<enum> Filter field names by their types. See Index Field Types.
indexes
array<resource> The name of a Haven OnDemand text index that you want to retrieve index fields for. You can use the public datasets, or your own text indexes. See Public Text Indexes. Default value: [wiki_eng].
max_values
number The number of field names to display. By default, the API displays a maximum of 1000 tags. Default value: 1000.
combine_fields
boolean Set to true to get the combined index fields of all specified indexes. Default value: false.
Enumeration Types

This API's parameters use the enumerations described below:

field_types
Filter field names by their types.
index List field names for index type fields.
parametric List field names for parametric type fields.
numeric List field names for numeric type fields.
autnrank List field names for rank type fields.
reference List field names for reference type fields.
date List field names for date type fields.
stored List field names for stored type fields.

This API returns a JSON response that is described by the model below. This single model is presented both as an easy to read abstract definition and as the formal JSON schema.

Asynchronous Use

Additional requests are required to get the result if this API is invoked asynchronously.

You can use /1/job/status/<job-id> to get the status of the job, including results if the job is finished.

You can also use /1/job/result/<job-id>, which waits until the job has finished and then returns the result.

Model
This is an abstract definition of the response that describes each of the properties that might be returned.
Retrieve Index Fields Response {
One of the following: Retrieve Index Fields Response_1 or Retrieve Index Fields Response_2
}
Retrieve Index Fields Response_1 {
total_fields ( integer ) The total number of indexed fields returned.
field_type_counts ( Field_type_counts ) The counts for each individual fields grouped by types.
autnrank_type_fields ( array[string] , optional) List of rank type fields.
date_type_fields ( array[string] , optional) List of date type fields.
index_type_fields ( array[string] , optional) List of index type fields.
numeric_type_fields ( array[string] , optional) List of numeric type fields.
parametric_type_fields ( array[string] , optional) List of parametric type fields.
reference_type_fields ( array[string] , optional) List of reference type fields.
stored_type_fields ( array[string] , optional) List of stored type fields.
}
Retrieve Index Fields Response_1:Field_type_counts {
autnrank_count ( integer , optional) The number of autnrank type fields.
date_count ( integer , optional) The number of date type fields.
index_count ( integer , optional) The number of index type fields.
numeric_count ( integer , optional) The number of numeric type fields.
parametric_count ( integer , optional) The number of parametric type fields.
reference_count ( integer , optional) The number of reference type fields.
stored_count ( integer , optional) The number of stored type fields.
}
Retrieve Index Fields Response_2 {
<index name> ( <Index Name> , optional)
}
Retrieve Index Fields Response_2:<Index Name> {
total_fields ( integer ) The total number of indexed fields returned.
field_type_counts ( Field_type_counts ) The counts for each individual fields grouped by types.
autnrank_type_fields ( array[string] , optional) List of rank type fields.
date_type_fields ( array[string] , optional) List of date type fields.
index_type_fields ( array[string] , optional) List of index type fields.
numeric_type_fields ( array[string] , optional) List of numeric type fields.
parametric_type_fields ( array[string] , optional) List of parametric type fields.
reference_type_fields ( array[string] , optional) List of reference type fields.
stored_type_fields ( array[string] , optional) List of stored type fields.
}
Retrieve Index Fields Response_2:<Index Name>:Field_type_counts {
autnrank_count ( integer , optional) The number of autnrank type fields.
date_count ( integer , optional) The number of date type fields.
index_count ( integer , optional) The number of index type fields.
numeric_count ( integer , optional) The number of numeric type fields.
parametric_count ( integer , optional) The number of parametric type fields.
reference_count ( integer , optional) The number of reference type fields.
stored_count ( integer , optional) The number of stored type fields.
}
Model Schema
This is a JSON schema that describes the syntax of the response. See json-schema.org for a complete reference.
{
    "oneOf": [
        {
            "properties": {
                "total_fields": {
                    "type": "integer"
                },
                "field_type_counts": {
                    "properties": {
                        "autnrank_count": {
                            "type": "integer"
                        },
                        "date_count": {
                            "type": "integer"
                        },
                        "index_count": {
                            "type": "integer"
                        },
                        "numeric_count": {
                            "type": "integer"
                        },
                        "parametric_count": {
                            "type": "integer"
                        },
                        "reference_count": {
                            "type": "integer"
                        },
                        "stored_count": {
                            "type": "integer"
                        }
                    },
                    "type": "object"
                },
                "autnrank_type_fields": {
                    "items": {
                        "type": "string"
                    },
                    "type": "array"
                },
                "date_type_fields": {
                    "items": {
                        "type": "string"
                    },
                    "type": "array"
                },
                "index_type_fields": {
                    "items": {
                        "type": "string"
                    },
                    "type": "array"
                },
                "numeric_type_fields": {
                    "items": {
                        "type": "string"
                    },
                    "type": "array"
                },
                "parametric_type_fields": {
                    "items": {
                        "type": "string"
                    },
                    "type": "array"
                },
                "reference_type_fields": {
                    "items": {
                        "type": "string"
                    },
                    "type": "array"
                },
                "stored_type_fields": {
                    "items": {
                        "type": "string"
                    },
                    "type": "array"
                }
            },
            "required": [
                "total_fields",
                "field_type_counts"
            ]
        },
        {
            "properties": {
                "<index name>": {
                    "type": "object",
                    "properties": {
                        "total_fields": {
                            "type": "integer"
                        },
                        "field_type_counts": {
                            "properties": {
                                "autnrank_count": {
                                    "type": "integer"
                                },
                                "date_count": {
                                    "type": "integer"
                                },
                                "index_count": {
                                    "type": "integer"
                                },
                                "numeric_count": {
                                    "type": "integer"
                                },
                                "parametric_count": {
                                    "type": "integer"
                                },
                                "reference_count": {
                                    "type": "integer"
                                },
                                "stored_count": {
                                    "type": "integer"
                                }
                            },
                            "type": "object"
                        },
                        "autnrank_type_fields": {
                            "items": {
                                "type": "string"
                            },
                            "type": "array"
                        },
                        "date_type_fields": {
                            "items": {
                                "type": "string"
                            },
                            "type": "array"
                        },
                        "index_type_fields": {
                            "items": {
                                "type": "string"
                            },
                            "type": "array"
                        },
                        "numeric_type_fields": {
                            "items": {
                                "type": "string"
                            },
                            "type": "array"
                        },
                        "parametric_type_fields": {
                            "items": {
                                "type": "string"
                            },
                            "type": "array"
                        },
                        "reference_type_fields": {
                            "items": {
                                "type": "string"
                            },
                            "type": "array"
                        },
                        "stored_type_fields": {
                            "items": {
                                "type": "string"
                            },
                            "type": "array"
                        }
                    },
                    "required": [
                        "total_fields",
                        "field_type_counts"
                    ]
                }
            }
        }
    ],
    "type": "object"
}
https://api.havenondemand.com/1/api/sync/retrieveindexfields/v2
/api/api-example/1/api/sync/retrieveindexfields/v2
Examples
See this API for yourself - select one of our examples below.
Wikipedia Fields
List the fields present in the English Wikipedia index.
Parameters
Optional
Name Type Value
field_types
array
indexes
array
max_values
number
combine_fields
boolean
(Default: False)


Async – Response An error occurred making the API request
Response Code:
Response Body

	
Making API Request…
Checking result of job

To try this API with your own data and use it in your own applications, you need an API Key. You can create an API Key from your account page - API Keys.

Output Refresh An error occurred making the API request View Input
Rendered RawHtml Response
Result Display
Response Code:
Response Body:

			
Make this call with curl

Version 2 (2015-11-30)

This page outlines the changes to the Retrieve Index Fields API from the previous version.

  • The fieldtype parameter has been renamed to field_types.
  • The index parameter has been renamed to indexes, and you can now query multiple indexes.
  • The combine_fields parameter has been added. When you query for multiple indexes, you can set this parameter to true if you want to combine the field information for all the indexes. By default, the response returns a separate section for each index.
  • The API response has changed. The response now always groups the fields by type, and it no longer returns the list of all fields.
  • The group_fields_by_type parameter has been removed. The response now always groups the fields by type.


If you would like to provide us with more information then please use the box below:

We will use your submission to help improve our product.