Skip to content

Commit 53e64b7

Browse files
committed
init docs
1 parent bdcf90c commit 53e64b7

File tree

9 files changed

+319
-131
lines changed

9 files changed

+319
-131
lines changed

docs/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
build/
2+
site/

docs/Project.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[deps]
2+
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"

docs/make.jl

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
using Documenter
2+
using Elasticsearch
3+
4+
makedocs(
5+
sitename = "Elasticsearch",
6+
format = Documenter.HTML(),
7+
modules = [Elasticsearch],
8+
pages = [
9+
"Home" => "index.md",
10+
"Transport" => [
11+
"Client" => "Transport/client.md"
12+
],
13+
"Api" => [
14+
"Base Actions" => "Api/index.md"
15+
]
16+
]
17+
)
18+
19+
# Documenter can also automatically deploy documentation to gh-pages.
20+
# See "Hosting Documentation" and deploydocs() in the Documenter manual
21+
# for more information.
22+
#=deploydocs(
23+
repo = "<repository url>"
24+
)=#

docs/src/Api/index.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# API Reference
2+
3+
```@meta
4+
CurrentModule = Elasticsearch.API
5+
```
6+
7+
High-level API to Elasticsearch. Each method receive Elasticsearch.Client and params as keyword arguments.
8+
Reponse similarto HTTP.Response, but it coverts body to String instead of CodeUnits or store body as Dict, if content type is application/json.
9+
10+
### Example
11+
12+
```julia
13+
using Elasticsearch
14+
15+
client = Elasticsearch.Client()
16+
17+
body = Dict(
18+
"query" => Dict(
19+
"match_all" => Dict()
20+
)
21+
)
22+
23+
response = Elasticsearch.search(client, body=body)
24+
25+
@show response.body["took"]
26+
```
27+
28+
```@docs
29+
Response
30+
search
31+
```

docs/src/Transport/client.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
2+
# Client documentation
3+
4+
```@meta
5+
CurrentModule = Elasticsearch.ElasticTransport
6+
```
7+
8+
Client is a base struct, that parse hosts and create connections to Elastic cluster.
9+
After initialization it can be passed to api methods to perform requests.
10+
11+
### Example
12+
13+
```julia
14+
using Elasticsearch
15+
16+
client = Elasticsearch.Client(host=(host="localhost", port=9200, scheme="http"))
17+
18+
perform_request(client, "GET", "/_search")
19+
```
20+
21+
```@docs
22+
Client
23+
perform_request
24+
```

docs/src/index.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Elasticsearch.jl
2+
3+
Documentation for Elasticsearch.jl

src/api/actions/search.jl

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,59 @@
11
using Mocking
22

3+
4+
"""
5+
Returns results matching a query.
6+
7+
- `index::Union{String, Vector{String}}`: A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices
8+
- `analyzer::String`: The analyzer to use for the query string
9+
- `analyze_wildcard::Bool`: specify whether wildcard and prefix queries should be analyzed (default: false)
10+
- `ccs_minimize_roundtrips::Bool`: Indicates whether network round-trips should be minimized as part of cross-cluster search requests execution
11+
- `default_operator::String`: The default operator for query string query (AND or OR) (options: AND, OR)
12+
- `df::String`: The field to use as default where no field prefix is given in the query string
13+
- `explain::Bool`: Specify whether to return detailed information about score computation as part of a hit
14+
- `stored_fields::{String, Vector{String}}`: A comma-separated list of stored fields to return as part of a hit
15+
- `docvalue_fields::{String, Vector{String}}` A comma-separated list of fields to return as the docvalue representation of a field for each hit
16+
- `from::Integer`: Starting offset (default: 0)
17+
- `force_synthetic_source::Bool`: Should this request force synthetic _source? Use this to test if the mapping supports synthetic _source and to get a sense of the worst case performance. Fetches with this enabled will be slower the enabling synthetic source natively in the index.
18+
- `ignore_unavailable::Bool`: Whether specified concrete indices should be ignored when unavailable (missing or closed)
19+
- `ignore_throttled::Bool`: Whether specified concrete, expanded or aliased indices should be ignored when throttled
20+
- `allow_no_indices::Bool`: Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)
21+
- `expand_wildcards::String`: Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all)
22+
- `lenient::Bool`: Specify whether format-based query failures (such as providing text to a numeric field) should be ignored
23+
- `preference::String`: Specify the node or shard the operation should be performed on (default: random)
24+
- `q::String`: Query in the Lucene query string syntax
25+
- `routing::Union{String, Vector{String}}`: A comma-separated list of specific routing values
26+
- `scroll::DateTime`: Specify how long a consistent view of the index should be maintained for scrolled search
27+
- `search_type::String`: Search operation type (options: query_then_fetch, dfs_query_then_fetch)
28+
- `size::Integer`: Number of hits to return (default: 10)
29+
- `sort::Union{String, Vector{String}}`: A comma-separated list of <field>:<direction> pairs
30+
- `_source::Union{String, Vector{String}}`: True or false to return the _source field or not, or a list of fields to return
31+
- `_source_excludes::Union{String, Vector{String}}`: A list of fields to exclude from the returned _source field
32+
- `_source_includes::Union{String, Vector{String}}`: A list of fields to extract and return from the _source field
33+
- `terminate_after::Integer`: The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early.
34+
- `stats::Union{String, Vector{String}}`: Specific 'tag' of the request for logging and statistical purposes
35+
- `suggest_field::String`: Specify which field to use for suggestions
36+
- `suggest_mode::String`: Specify suggest mode (options: missing, popular, always)
37+
- `suggest_size::Integer`: How many suggestions to return in response
38+
- `suggest_text::String`: The source text for which the suggestions should be returned
39+
- `timeout::DateTime`: Explicit operation timeout
40+
- `track_scores::Bool`: Whether to calculate and return scores even if they are not used for sorting
41+
- `[Boolean|long] :track_total_hits Indicate if the number of documents that match the query should be tracked. A number can also be specified, to accurately track the total hit count up to the number.
42+
- `allow_partial_search_results::Bool`: Indicate if an error should be returned if there is a partial search failure or timeout
43+
- `typed_keys::Bool`: Specify whether aggregation and suggester names should be prefixed by their respective types in the response
44+
- `version::Bool`: Specify whether to return document version as part of a hit
45+
- `seq_no_primary_term::Bool`: Specify whether to return sequence number and primary term of the last modification of each hit
46+
- `request_cache::Bool`: Specify if request cache should be used for this request or not, defaults to index level setting
47+
- `batched_reduce_size::Integer`: The number of shard results that should be reduced at once on the coordinating node. This value should be used as a protection mechanism to reduce the memory overhead per search request if the potential number of shards in the request can be large.
48+
- `max_concurrent_shard_requests::Integer`: The number of concurrent shard requests per node this search executes concurrently. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests
49+
- `pre_filter_shard_size::Integer`: A threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. This filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on its rewrite method ie. if date filters are mandatory to match but the shard bounds and the query are disjoint.
50+
- `rest_total_hits_as_int::Bool`: Indicates whether hits.total should be rendered as an integer or an object in the rest search response
51+
- `min_compatible_shard_node::String`: The minimum compatible version that all shards involved in search should have for this request to be successful
52+
- `headers::Dict`: Custom HTTP headers
53+
- `body::Dict`: The search definition using the Query DSL
54+
55+
See https://www.elastic.co/guide/en/elasticsearch/reference/current/search-search.html
56+
"""
357
function search(client::Client; kwargs...)
458
arguments = Dict(kwargs)
559

src/api/response.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
using HTTP
22

3+
"""
4+
Store Elastic response with body, headers and status
5+
6+
function Response(http_response::HTTP.Response)
7+
8+
Create response structure and convert body to String if it's CodeUnits
9+
"""
310
struct Response
411
status
512
body

0 commit comments

Comments
 (0)