$ norch --help
Usage: norch [options]
Options:
-h, --help output usage information
-V, --version output the version number
-p, --port <port> specify the port, defaults to 3030
-i, --norchHome <indexPath> specify the name of the index directory, defaults to norch-index
-l, --logLevel <logLevel> specify the loglevel- silly | debug | verbose | info | warn | error
-m, --machineReadable machine readable, logo not printed, all stdout/stderr is JSON
Endpoint | Method | Response | Typical Use Case |
---|---|---|---|
/add |
POST |
status code | Add documents to the index |
/availableFields |
GET |
stream | Discover the name of fields which can be searched in |
/buckets |
GET |
stream | Aggregate documents on ranges of metadata |
/categorize |
GET |
stream | Aggregate documents on single metadata values |
/concurrentAdd |
POST |
status code | For when more than one source is adding documents to the index at the same time |
/createSnapshot |
POST |
status code | Create a snapshot of the index |
/delete |
DELETE |
status code | Remove documents from index |
/docCount |
GET |
object | Counts total document in index |
/flush |
DELETE |
status code | Remove all documents from index |
/get |
GET |
stream | Get documents by ID |
/import |
POST |
file | Import/merge an existing index into this one |
/latestSnapshot |
GET |
file | Download the latest index snapshot |
/listSnapshots |
GET |
file | See list of snapshots |
/match |
GET |
stream | Match by linguistic similarity- autosuggest, autocomplete |
/search |
GET |
stream | Search in the index |
/totalHits |
GET |
object | Show number of hits that a given query returns |
TODO
Wrapper for search-index's
buckets
method. Get user defined aggregations of documents.
Query parameter: q
Example:
curl -X GET http://localhost:3030/buckets -G --data-urlencode q@- <<REQUEST_BODY
{
query: [{
AND: {
'*': ['reuter']
}
}],
buckets: [{
field: 'topics',
gte: 'barley',
lte: 'barley',
set: true
}, {
field: 'topics',
gte: 'lin',
lte: 'oat',
set: true
}]
}
REQUEST_BODY
Wrapper for search-index's
categorize
method. Aggregate documents on metadata: Example: show counts by topic value
Query parameter: q
Example:
curl -X GET http://localhost:3030/categorize -G --data-urlencode q@- <<REQUEST_BODY
{
"query": [{
"AND": {
"*": ["reuter"]
}
}],
"category": {
"field": "topics"
}
}
REQUEST_BODY
Count the documents in the index
Get documents by ID
Query parameter: ids An array of document ids
Example:
curl -X GET http://localhost:3030/get -G --data-urlencode ids@- <<REQUEST_BODY
["3", "7"]
REQUEST_BODY
Return the latest snapshot of the index. Generated the last time
/snapshot
was run
Show a list of all available snapshots
Wrapper for search-index's
match
method. Returns word suggestions based on frequency in the index, used for
making autosuggest and autocomplete functions.
Query parameter: q
Example:
curl -X GET http://localhost:3030/match -G --data-urlencode q@- <<REQUEST_BODY
{
"beginsWith": "lon"
}
REQUEST_BODY
Wrapper for search-index's
search
method. Search in the index. Filtering on buckets and categories are applied as fielded
search for the regular query object.
Query parameter: q
Example:
curl -X GET http://localhost:3030/search -G --data-urlencode q@- <<REQUEST_BODY
{
"query": {
"AND": {
"*": ["marathon"]
}
}
}
REQUEST_BODY
Example, filtering on buckets:
curl -X GET http://localhost:3030/search -G --data-urlencode q@- <<REQUEST_BODY
{
"query": {
"AND": {
"*": ["marathon"],
"finishingTime": [{
"gte": "7200",
"lte": "8999"
}]
}
}
}
REQUEST_BODY
Example, filtering on categories:
curl -X GET http://localhost:3030/search -G --data-urlencode q@- <<REQUEST_BODY
{
"query": {
"AND": {
"*": ["marathon"],
"equipment": ["shoes"]
}
}
}
REQUEST_BODY
Show total number of hits for a qiven query. Queries take the same
format as for /search
Add documents to the index.
Example: (where justTen.json is a newline separated object stream)
curl -X POST -d @justTen.str http://localhost:3030/add
API: https://github.com/fergiemcdowall/search-index/blob/master/docs/API.md#defaultpipeline
Use this method when several sources are adding documents simultaneously
Creates a snapshot of the index which is then available for export
under /latestSnapshot
Import or merge an existing snapshot into this index
Deletes documents from the index
Query parameter: ids An array of document ids
Example:
curl -X DELETE http://localhost:3030/delete -G --data-urlencode ids@- <<REQUEST_BODY
["7", "1"]
REQUEST_BODY
Deletes all documents from index