Skip to content

Instantly share code, notes, and snippets.

@KadekM
KadekM / bug.json
Last active March 1, 2021 15:54
missing.json
PUT jobs
{
"mappings": {
"properties": {
"name": {
"type": "text"
},
"namec": {
"type": "completion",
@KadekM
KadekM / Markdium-Scala.scala
Created February 28, 2021 21:05
Markdium-
val fields = generate(x.title).map(Json.fromString)
val newJson = x.asJson.mapObject(x => x.add("title_completion", Json.arr(fields: _*)))
out.write(newJson.printWith(Printer.noSpaces))
@KadekM
KadekM / Markdium-Scala.scala
Last active March 1, 2021 17:27
Markdium-
scalacOptions += "-Ymacro-annotations"
val kantanVersion = "0.6.1"
libraryDependencies ++= Seq(
"com.nrinaudo" %% "kantan.csv-generic" % kantanVersion,
"com.nrinaudo" %% "kantan.csv" % kantanVersion,
)
val circeVersion = "0.12.3"
@KadekM
KadekM / Markdium-Scala.scala
Created February 28, 2021 21:05
Markdium-
@JsonCodec
case class Movie(
adult: Boolean,
belongs_to_collection: Json,
budget: Long,
genres: Json,
homepage: String,
id: Long,
imdb_id: String,
original_language: String,
@KadekM
KadekM / Markdium-JSON.json
Created February 28, 2021 21:05
Markdium-
PUT _template/template_movies_context
{
"index_patterns": [
"movies*"
],
"mappings": {
"properties": {
"title_completion": {
"type": "completion",
"contexts": [
@KadekM
KadekM / Markdium-JSON.json
Created February 28, 2021 21:05
Markdium-
The Lord of the Rings
Rings
The Lord of the Rings: The Fellowship of the Ring
The Lord of the Rings: The Return of the King
@KadekM
KadekM / Markdium-JSON.json
Created February 28, 2021 21:05
Markdium-
The Lord of the Rings
The Lord of the Rings: The Fellowship of the Ring
The Lord of the Rings: The Return of the King
The Lord of the Rings: The Two Towers
Lord of Illusions
@KadekM
KadekM / Markdium-JSON.json
Created February 28, 2021 21:05
Markdium-
The Lord of the Rings
The Lord of the Rings: The Two Towers
The Lord of the Rings: The Fellowship of the Ring
The Lord of the Rings: The Return of the King
@KadekM
KadekM / Markdium-JSON.json
Last active March 1, 2021 17:26
Markdium-
POST movies/_doc
{
"title": "The Lord of the Rings: The Two Towers",
"title_completion": ["The Lord of the Rings: The Two Towers", "The Two Towers"]
}
@KadekM
KadekM / Markdium-JSON.json
Created February 28, 2021 21:05
Markdium-
{
"input":["Waiting to Exhale","to Exhale","Exhale"],
"contexts":{"movie_category":["Comedy","Drama","Romance"]}
}