This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PUT jobs | |
{ | |
"mappings": { | |
"properties": { | |
"name": { | |
"type": "text" | |
}, | |
"namec": { | |
"type": "completion", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@JsonCodec | |
case class Movie( | |
adult: Boolean, | |
belongs_to_collection: Json, | |
budget: Long, | |
genres: Json, | |
homepage: String, | |
id: Long, | |
imdb_id: String, | |
original_language: String, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PUT _template/template_movies_context | |
{ | |
"index_patterns": [ | |
"movies*" | |
], | |
"mappings": { | |
"properties": { | |
"title_completion": { | |
"type": "completion", | |
"contexts": [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"input":["Waiting to Exhale","to Exhale","Exhale"], | |
"contexts":{"movie_category":["Comedy","Drama","Romance"]} | |
} |
NewerOlder