benashford / rs-es

A Rust client for the ElasticSearch REST API
Apache License 2.0
217 stars 44 forks source link

Implement "Create Index" of Indices API #86

Open benashford opened 7 years ago

benashford commented 7 years ago

https://www.elastic.co/guide/en/elasticsearch/reference/2.0/indices-create-index.html

rrichardson commented 7 years ago

Am I reading this right that there currently is no way to create an index in rs-es? Do you have a suggested workaround?

RoxasShadow commented 7 years ago

@rrichardson you can create and map an index with the mapping module, but it's not very _rs-es_ish and has some limitations (see #75).

This is why in the indices-api branch @benashford is rewriting it properly. If what has been done there so far is enough for you, then using that branch would be the best.

benashford commented 7 years ago

rs-es started as just supporting the query API and has been gradually growing outwards to include everything else in the ElasticSearch API.

As @RoxasShadow there is a preliminary module already, but this only supports a fraction of the total surface area of ElasticSearch's Indices API. This ticket is to support the rest of it.

As to the question of workarounds, it comes down to the origins of rs-es where it initially only supported querying. The first use was in projects where other scripts (e.g. Ruby scripts posting directly to the ES API) setup the project structure.

The goal is to have rs-es do everything so it can be used for, well, everything, rather than needing support scripts etc. for the initial setup.

rrichardson commented 7 years ago

Thanks for the info. As of yet I'm not entirely sure what is es-rs-ish in terms of APIs, but if there are some suggested API signatures, I am happy to fill them in and submit PRs.

benashford commented 7 years ago

There's not really any written rules, rather the goal to be consistent with: a) itself, b) Rust conventions, and c) ElasticSearch conventions. In reality there's a lot of conflict here, the main goals are: to be strongly typed, using builder objects. Take a look around the existing parts like querying, if it's unclear then that would be useful to know too, as either the documentation doesn't make sense (or is too sparse) or its not as consistent as I want it to be.

(Incidentally, if you haven't already found it, there's a alternative Rust ES client that does things the opposite way here: https://github.com/elastic-rs/elastic for those situations that are more dynamic)