- App Search Guide: other versions:
- Installation
- Getting started
- Authentication
- Limits
- Users and access
- Guides
- Adaptive relevance events logs reference
- Analytics Tags
- Crawl web content
- Crawl a private network using a web crawler on Elastic Cloud
- Crawl custom fields using proxy
- Curations
- Elasticsearch search
- Elasticsearch index engines
- Create Elasticsearch index engines
- Configure dynamic field mappings and analyzers in an Elasticsearch index engine
- Elasticsearch engines text field conventions
- Facets
- Hierarchical Facets
- Indexing Documents
- Language Optimization
- Log settings
- Meta Engines
- Precision tuning (beta)
- Query Suggestions
- Search UI
- Relevance Tuning
- Result Settings
- Result Suggestions
- Role based access control (RBAC)
- Sanitization, Raw or Snippet
- Search
- Synonyms
- View web crawler events logs
- App Search web crawler
- Web crawler FAQ
- Web crawler reference
- Web crawler events logs reference
- API Reference
- Adaptive relevance API reference (beta)
- Analytics APIs
- Analytics clicks API
- Analytics counts API
- Analytics queries API
- API logs API
- Click API
- Credentials API
- Curations API reference
- Documents API
- Elasticsearch search API
- Engines API
- Log settings API
- Multi search API
- Query suggestion API
- Schema API
- Search API
- Search API boosts
- Search API facets
- Search API filters
- Search API group
- Search API precision (beta)
- Search API result fields
- Search API search fields
- Search API sort
- Search API analytics tags
- Search settings API
- Search Explain API
- Source engines API
- Synonyms API
- Web crawler API reference
- API Clients
- Configuration
- Known issues
- Troubleshooting
Schema API
editSchema API
editWant to start with the core concepts? Give our Indexing Documents guide a read.
Alter the schema fields of your Engine.
Before you begin, familiarize yourself with the schema design principles within the API Overview.
Authentication
editFor authentication, the Schema endpoint requires...
-
The name of your Engine:
[ENGINE]
-
A Private API Key:
[PRIVATE_API_KEY]
curl -X GET '<ENTERPRISE_SEARCH_BASE_URL>/api/as/v1/engines/[ENGINE]/schema' \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer [PRIVATE_API_KEY]'
List Schema
editGET <ENTERPRISE_SEARCH_BASE_URL>/api/as/v1/engines/{ENGINE_NAME}/schema
Example - A GET
request to return the whole schema.
curl -X GET '<ENTERPRISE_SEARCH_BASE_URL>/api/as/v1/engines/national-parks-demo/schema' \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer private-xxxxxxxxxxxxxxxxxxxx'
Example Response
{ "description": "text", "nps_link": "text", "states": "text", "title": "text", "visitors": "number", "world_heritage_site": "text", "location": "geolocation", "acres": "number", "date_established": "date", "square_km": "number" }
Update Schema
editWhen updating a Schema, you can either...
Updates an Existing Schema
editPOST <ENTERPRISE_SEARCH_BASE_URL>/api/as/v1/engines/{ENGINE_NAME}/schema
Example - A POST
request that changes the square_km
field from number to text.
curl -X POST '<ENTERPRISE_SEARCH_BASE_URL>/api/as/v1/engines/national-parks-demo/schema' \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer private-xxxxxxxxxxxxxxxx' \ -d '{ "square_km": "text" }'
Example Response
{ "description": "text", "nps_link": "text", "states": "text", "title": "text", "visitors": "number", "world_heritage_site": "text", "location": "geolocation", "acres": "number", "date_established": "date", "square_km": "text" }
Creates a new Schema Field
editYou may have up to 64 fields.
Fields cannot be named: engine_id, highlight, or, and, not, any, all, none.
Example - A POST
request to add a new number field, square_mi
.
curl -X POST '<ENTERPRISE_SEARCH_BASE_URL>/api/as/v1/engines/national-parks-demo/schema' \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer private-xxxxxxxxxxxxxxxx' \ -d '{ "square_mi": "number" } '
Example Response
{ "description": "text", "nps_link": "text", "states": "text", "title": "text", "visitors": "number", "world_heritage_site": "text", "location": "geolocation", "acres": "number", "date_established": "date", "square_km": "number", "square_mi": "number" }
Errors
editIf one field fails validation then the entire set will fail.
Name indicates the name of the field. Type indicates the type of the field.
400 Error Message |
Solution |
"Type is not included in the list" |
The allowed types are: text, number, date, geolocation". Ensure that no spaces are included and only one of the four types is present. Watch out for integer, which will not work - expects number. |
"Name cannot contain whitespace" |
Can not contain any whitespace characters like |
"Name cannot have a leading underscore" |
Can not start with a leading underscore like |
"Name cannot contain more than 64 characters" |
Very long field names are not allowed. |
"Name cannot be a reserved field (engine_id, highlight, or, and, not, any, all, none)" |
These field names are reserved for your safety :). For example, trying to define an |
"Name can only contain lowercase letters, numbers, and underscores" |
No dashes, capitals, strange characters or other such silliness! |
"Name must contain a lowercase letter" |
You can not have a field with only capital letters. |
"Name must be unique" |
Each field name must be unique. |
What’s Next?
editThe Schema endpoint is how you adjust your foundational data model. Now that you know how to make Schema changes via the API, you may be interested in exploring deeper into Indexing Documents. Alternatively, you may be into some of the deeper analytics presented by Curations and Clickthrough.
On this page
ElasticON events are back!
Learn about the Elastic Search AI Platform from the experts at our live events.
Register now