Skip to content

Instantly share code, notes, and snippets.

@jaohaohsuan
Created January 26, 2017 18:13
Show Gist options
  • Select an option

  • Save jaohaohsuan/f85c7f325ceed0be80a167cbf0bdf550 to your computer and use it in GitHub Desktop.

Select an option

Save jaohaohsuan/f85c7f325ceed0be80a167cbf0bdf550 to your computer and use it in GitHub Desktop.
val lines = """|PUT my_index
|{
| "mappings": {
| "my_type": {
| "properties": {
| "location": {
| "type": "geo_point"
| }
| }
| }
| }
|}""".stripMargin
// mtach first line as HttpRequest
val r = """^(.*)""".r
val Some(cmd) = r.findFirstIn(lines)
// cmd: String = PUT my_index
val body = lines.substring(lines.indexOf('\n')+1);
// body: String =
// {
// "mappings": {
// "my_type": {
// "properties": {
// "location": {
// "type": "geo_point"
// }
// }
// }
// }
// }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment