forked from jaeksoft/opensearchserver
-
Notifications
You must be signed in to change notification settings - Fork 0
Search template field set
AlexandreToyer edited this page Sep 30, 2013
·
3 revisions
Use this API to create or update a search template.
Requirement: OpenSearchServer v1.5
URL: /services/rest/index/{index_name}/search/field/{template_name}
Method: PUT
Header:
-
Content-Type (required):
application/json -
Accept (optional returned type):
application/jsonorapplication/xml
URL parameters:
- index_name (required): The name of the index.
- template_name (required): The name of the search template.
Raw data (PUT): The search field query either in JSON or XML format.
{
"successful": true,
"query": {
"start": 0,
"rows": 10,
"lang": "ENGLISH",
"operator": "AND",
"collapsing": {
"max": 2,
"mode": "OFF",
"type": "OPTIMIZED"
},
"returnedFields": [
"url"
],
"snippets": [
{
"field": "title",
"tag": "em",
"separator": "...",
"maxSize": 200,
"maxNumber": 1,
"fragmenter": "NO"
},
{
"field": "content",
"tag": "em",
"separator": "...",
"maxSize": 200,
"maxNumber": 1,
"fragmenter": "SENTENCE"
}
],
"enableLog": false,
"searchFields": [
{
"field": "title",
"phrase": true,
"boost": 10
},
{
"field": "content",
"phrase": true,
"boost": 1
},
{
"field": "titleExact",
"phrase": true,
"boost": 10
},
{
"field": "contentExact",
"phrase": true,
"boost": 1
}
]
}
}The search template has been created or updated.
HTTP code: 200
Content (application/json):
{
"successful": true,
"info": "Template updated: my_search"
}The creation/update failed. The reason is provided in the content.
HTTP code: 500
Using CURL:
curl -XPUT -H "Content-Type: application/json" \
-d '...' \
http://localhost:8080/services/rest/index/my_index/search/field/my_search