要在 /music 索引下创建一个类型,可插入一个文档。在第一个示例中,您的文档包含数据(包含一行)“Deck the Halls” 的歌词,这是一首最初由威尔士诗人 John Ceirog Hughes 于 1885 年编写的传统的圣诞歌曲。
要将包含 “Deck the Halls” 的文档插入索引中,可运行以下命令(将该命令和本教程的其他 cURL 命令都键入到一行中):
curl -XPUT "http://localhost:9200/music/songs/1" -d '
{ "name": "Deck the Halls", "year": 1885, "lyrics": "Fa la la la la" }'
前面的命令使用 PUT 动词将一个文档添加到 /songs 文档类型,并为该文档分配 ID 1。URL 路径显示为 index/doctype/ID。
查看文档
要查看该文档,可使用简单的 GET 命令:
curl -XGET "http://localhost:9200/music/songs/1"
Elasticsearch 使用您之前 PUT 进索引中的 JSON 内容作为响应:
{"_index":"music","_type":"songs","_id":"1","_version":1,"found":true,"_source":
{ "name": "Deck the Halls", "year": 1885, "lyrics": "Fa la la la la" }}
更新文档
如果您认识到日期写错了,并想将它更改为 1886 怎么办?可运行以下命令来更新文档:
curl -XPUT "http://localhost:9200/music/lyrics/1" -d '{ "name":
"Deck the Halls", "year": 1886, "lyrics": "Fa la la la la" }'
{
"artist": "Wallace Saunders",
"year": 1909,
"styles": ["traditional"],
"album": "Unknown",
"name": "Ballad of Casey Jones",
"lyrics": "Come all you rounders if you want to hear
The story of a brave engineer
Casey Jones was the rounder's name....
Come all you rounders if you want to hear
The story of a brave engineer
Casey Jones was the rounder's name
On the six-eight wheeler, boys, he won his fame
The caller called Casey at half past four
He kissed his wife at the station door
He mounted to the cabin with the orders in his hand
And he took his farewell trip to that promis'd land
Chorus:
Casey Jones--mounted to his cabin
Casey Jones--with his orders in his hand
Casey Jones--mounted to his cabin
And he took his... land"
}
{
"artist": "Clarence Ashley",
"year": 1920
"name": "Walking Boss",
"styles": ["folk","protest"],
"album": "Traditional",
"lyrics": "Walkin' boss
Walkin' boss
Walkin' boss
I don't belong to you
I belong
I belong
I belong
To that steel driving crew
Well you work one day
Work one day
Work one day
Then go lay around the shanty two"
}
{"took":107,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":2,"max
_score":0.15625,"hits":[{"_index":"music","_type":"songs","_id":"2","_
score":0.15625,"_source":{"artist": "Wallace Saunders","year": 1909,"styles":
["traditional"],"album": "Unknown","name": "Ballad of Casey Jones","lyrics": "Come all you rounders
if you want to hear The story of a brave engineer Casey Jones was the rounder's name.... Come all
you rounders if you want to hear The story of a brave engineer Casey Jones was the rounder's name
On the six-eight wheeler, boys, he won his fame The caller called Casey at half past four He kissed
his wife at the station door He mounted to the cabin with the orders in his hand And he took his
farewell trip to that promis'd land Chorus: Casey Jones--mounted to his cabin Casey Jones--with his
orders in his hand Casey Jones--mounted to his cabin And he took his... land"
}},{"_index":"music","_type":"songs","_id":"3","_score":0.06780553,"_source":{"artist": "Clarence
Ashley","year": 1920,"name": "Walking Boss","styles": ["folk","protest"],"album":
"Traditional","lyrics": "Walkin' boss Walkin' boss Walkin' boss I don't belong to you I belong I
belong I belong To that steel driving crew Well you work one day Work one day Work one day Then go
lay around the shanty two"}}]}}
这一行显示了搜索 API 的简单用法。使用 prepareSearch 方法指定一个索引(在本例中为 music),然后执行查询。查询基本上显示为 “Give me all of the records in the music index.”。另外,将文档类型设置为 lyrics,但在这个简单用例中没有必要这么做,因为索引仅包含一种文档类型。在更大的应用程序,需要执行这种设置。这个 API 调用类似于您之前看到的 curl -XGET "http://localhost:9200/music/lyrics/_search" 调用。
A ROWID is an identification tag unique for each row of an Oracle Database table. The ROWID can be thought of as a virtual column, containing the ID for each row.
The oracle.sql.ROWID class i
public class DeleteNode_O1_Time {
/**
* Q 60 在O(1)时间删除链表结点
* 给定链表的头指针和一个结点指针(!!),在O(1)时间删除该结点
*
* Assume the list is:
* head->...->nodeToDelete->mNode->nNode->..
格式定义The format specifiers supported by the NSString formatting methods and CFString formatting functions follow the IEEE printf specification; the specifiers are summarized in Table 1. Note that you c
概念
AngularJS is a structural framework for dynamic web apps.
了解更多详情请见原文链接:http://www.gbtags.com/gb/share/5726.htm
Directive
扩展html,给html添加声明语句,以便实现自己的需求。对于页面中html元素以ng为前缀的属性名称,ng是angular的命名空间