sksamuel / tribune Goto Github PK
View Code? Open in Web Editor NEWKotlin 'parse not validate'
License: Apache License 2.0
Kotlin 'parse not validate'
License: Apache License 2.0
Can I have multiple channels mapping to one different index each one?
So far I have been trying this workaround... I want to update access_point and and active_user ...
For the first one:
curl -XPUT 'http://localhost:9200/_river/redisriver/_meta' -d '{
"type": "redis",
"redis": {
"json" : true,
"channels": "access_point"
},
"index": {
"name": "access_point"
}
}'
So, I publish with
redis-cli PUBLISH access_point '{ "ipaddr": "0.0.0.0", "full_ipaddr": "", "total_clients": 0 }'
But, when I want to publish to the active_user index, even if update the _meta, I have to RESTART elasticsearch to pickup the changes....
curl -XPUT 'http://localhost:9200/_river/redisriver/_meta' -d '{
"type": "redis",
"redis": {
"json" : true,
"channels": "active_user"
},
"index": {
"name": "active_user"
}
}'
redis-cli PUBLISH active_user '{ "ipaddr": "192.168.101.81", "usage": 453, "macaddr": "e4:d5:3d:85:1e:ed", "domain": "domain_1" }'
What are your suggestion to get around this problem? and is there a way to pickup _meta changes without restarting elasticsearch?
Hi I'm using redisriver 1.1.0 and ES 1.4
I have an alias for time series data in ES
curl -XPOST localhost:9200/_aliases -d '
{
"actions":
[
{ "add": { "alias": "cm", "index": "'$day'" }}
]
}'
when creating the redisriver with
curl -XPUT 'http://localhost:9200/_river/redisriver/_meta' -d '{
"type": "redis",
"redis": {
"hostname": "localhost",
"port" : "6379",
"json" : true,
"messageField" : "message",
"channels": "rdr"
},
"index": {
"name": "cm"
}
}'
I get the following error in the ES log
[2014-11-28 11:24:43,657][ERROR][org.elasticsearch.plugin.river.redis.RedisSubscriber] ... error {}
org.elasticsearch.indices.InvalidIndexNameException: [cm] Invalid index name [cm], already exists as alias
at org.elasticsearch.cluster.metadata.MetaDataCreateIndexService.validateIndexName(MetaDataCreateIndexService.java:197)
at org.elasticsearch.cluster.metadata.MetaDataCreateIndexService.validate(MetaDataCreateIndexService.java:558)
at org.elasticsearch.cluster.metadata.MetaDataCreateIndexService.access$200(MetaDataCreateIndexService.java:87)
at org.elasticsearch.cluster.metadata.MetaDataCreateIndexService$2.execute(MetaDataCreateIndexService.java:243)
at org.elasticsearch.cluster.service.InternalClusterService$UpdateTask.run(InternalClusterService.java:329)
at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.run(PrioritizedEsThreadPoolExecutor.java:153)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Googling found that elasticsearch-river-mongodb had the same issue but it is now resolved.
richardwilly98/elasticsearch-river-mongodb#163
Cheers
Dale
Per you readme it appears that the redis river can subscribe to a channel pattern but it doesn't seem to work.
I've tried to subscribe to channels: '*'
and I can't get the river to index any documents, if I subscribe to each individual channel it will begin to index
My es version 1.2.x
I installed it in es.
log display : [INFO ][org.elasticsearch.plugin.river.redis.RedisSubscriber] : Starting redis subscriber
But, I can't saw any data in es.
It's my config.
curl -XPUT "http://localhost:9200/_river/redisriver/_meta" -d '{
"type": "redis",
"redis": {
"hostname": "10.0.0.21",
"port" : "6379",
"json" : true,
"channels" : "*"
},
"index": {
"name": "redisindex"
}
}'
Do you have any suggest??
Thanks
Nick
When running ./gradlew check
I get the following failure
> Task :tribune-core:compileKotlin FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':tribune-core:compileKotlin'.
> Inconsistent JVM-target compatibility detected for tasks 'compileJava' (17) and 'compileKotlin' (11).
Consider using JVM Toolchain: https://kotl.in/gradle/jvm/toolchain
Learn more about JVM-target validation: https://kotl.in/gradle/jvm/target-validation
1)The documentation says that:
The sanitized value is passed through the validation chain and so is present in any validations that occur after the sanitized call, as well as being included in the final result.
You can replicate the problem:
case class Username(value: String)
val email = "[email protected]"
val validator = Validator[Username]
.sanitize(_.value)(_.toLowerCase)
.validate(_.value){_.matches("""^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$""")}
validator(Username(email)) shouldBe valid(Username(email.toLowerCase))
Is false
But when I change the order:
def validator = Validator[Username]
.validate(_.value){_.matches("""^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$""")}
.sanitize(_.value)(_.toLowerCase)
validator(Username(email)) shouldBe valid(Username(email.toLowerCase))
is true
2) Additionally, it looks like nested sanitisation does not work.
FlatMap function is currently defined as
fun <I, A, B, E> Parser<I, A, E>.flatMap(f: (A) -> EitherNel<E, B>): Parser<I, B, E> = ..
Given that actually Parser
is a function (I)->EitherNel<E,O>
, I find the above flatMap confusing.
I would expect that flatMap would have the shape bellow:
fun <I, O, E : E2, I2 : I, O2, E2> Parser<I, O, E>.flatMap(f: (O) -> Parser<I2, O2, E2>): Parser<I2, O2, E2> = ...
This is more or less from your example on the README:
import com.sksamuel.monkeytail.Validator
import com.sksamuel.monkeytail._
import com.sksamuel.monkeytail.ValidatorSyntax._
case class Designation(prefix: String, code: String)
case class Starship(name: String, maxWarp: Double, designation: Designation)
implicit val designationValidator = Validator[Designation]
.validate(_.prefix)(prefix => prefix != null && (prefix.startsWith("NCC") || prefix.startsWith("NX")))
.validate(_.code)(!_.isEmpty)
object MaxWarpExceededViolation extends Violation
val starshipValidator = Validator[Starship]
.validate(_.name)(_ != null)
.validate(_.maxWarp)(_ < 10)(MaxWarpExceededViolation)
.valid(_.designation)(designationValidator) // this will require the previous implicit.
val starship = Starship("USS Enterprise", maxWarp = 5.0, designation = Designation("NCC-foo", ""))
val result = starshipValidator(starship)
The output of the result
has what appears to be a bug in the path returned:
result: Validated[NonEmptyList[Violation],Starship] = Invalid(NonEmptyList(DefaultViolation(Invalid value: ,Path(List(code)))))
Path(List(code))
should be Path(List(designation, code))
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.