33
3分鐘Azure Search自我 介紹 Jaja

3分鐘Azure search自我介紹 ( 3 min talking about Azure Search)

Embed Size (px)

Citation preview

3分鐘Azure Search自我介紹

Jaja

開始前…

使用前要先有服務的URL跟API金錀

服務 URL命名完後不可修改

要指定API版本

一組服務金錀有分為Manger(2組)與Query(50組)

建立Index時column屬性的設定會影響後續查詢

免費試用限制

儲存空間上限50MB

文件數量10000個

最多只能建3個索引

不保證你的效能(笑)

大家都有的限制-Request

Maximum of 16 MB per request

Maximum 8 KB URL length

Maximum 1000 documents per batch of index uploads, merges, or deletes.

Maximum 25 characters of text in Suggest API request, minimum 3 characters

Maximum 32 fields in $orderby clause

Maximum search term size is 32766 bytes (32 KB minute 2 bytes) of UTF-8 encoded text

大家都有的限制-Response

Maximum 1000 documents returned per page of search results

Maximum 10 suggestions returned per Suggest API request

兩個預覽的板本

兩種操作

There are two types of actions that can be executed against the Azure Search Service:

• Index Management: This includes administrative tasks that are executed against a search

service or search index.

• Document Actions: These actions query and manage the corpus for a given index

索引 操作

CREATE -> POST /indexes?api-version=2014-07-31-Preview

UPDATE -> PUT /indexes/[index name]?api-version=2014-07-31-Preview

DELETE -> DELETE /indexes/[index name]?api-version=2014-07-31-Preview

GET -> GET /indexes/[index name]?api-version=2014-07-31-Preview

LIST -> GET /indexes?api-version=2014-07-31-Preview

文件 操作

DML -> POST /indexes/[index name]/docs/index?api-version=2014-07-31-Preview

GET -> GET /indexes/[index name]/docs?[query parameters]

Lookup -> GET /indexes/[index name]/docs/[key]?[query parameters]

DML 操作是用JSON欄位 @search.action做定義

"@search.action": "upload (default) | merge | mergeOrUpload | delete"

服務命名規則

長度需介於2-15之間

只能用小寫英文數字與破折號( - )

不能用連續的破折號 ( -----helloworld-----)

第二個字元不能用破折號

不要用破折號!!!

索引命名規則

長度需介於2-128之間

只能用小寫英文數字與破折號( - )

不能用連續的破折號 ( -----helloworld-----)

不能有斜線( \ / )或是點( . )

欄位命名規則

除了英文數字,還可以用底線 ( _ )

但是要英文開頭

不能有點( . )、分號( : ) 跟小老鼠 ( @ )

不能用azureSearch當開頭

文件命名規則

不準用底線開頭 ( _ )

不能有斜線( \ / )與點( . )

建議用 | 來分割你的複合主鍵

Tips

增加複本可以提升每秒查詢數量與高可用性(最少3個)

複本會比較常使用

資料分割只會應用在特定的場合

C# 使用Azure Search

請愛用 HttpClient

Header 一定要有 api-key

搭配HttpRequestMessage送出資料

傳輸的資料內容一定是JSON格式

詳細的範例 : https://azuresearchadventureworksdemo.codeplex.com/

記得用NuGet console更新一下MVC

Update-package -reinstall Microsoft.AspNet.Mvc

End

English Version

Begin…

Need service URL and API Key before start

Cannot rename service name

Requests must include the api-version

One service include two API Key – Manage(2) and Query (50) .

Index column attribute will affect your query

Free trial Limite

Storage limit 50MB

Documents limit 10000

Only 3 index

They don't ensure service usable

Request Limit

Maximum of 16 MB per request

Maximum 8 KB URL length

Maximum 1000 documents per batch of index uploads, merges, or deletes.

Maximum 25 characters of text in Suggest API request, minimum 3 characters

Maximum 32 fields in $orderby clause

Maximum search term size is 32766 bytes (32 KB minute 2 bytes) of UTF-8 encoded text

Response Limit

Maximum 1000 documents returned per page of search results

Maximum 10 suggestions returned per Suggest API request

Two Preview version Now

Two Operating

There are two types of actions that can be executed against the Azure Search Service:

• Index Management: This includes administrative tasks that are executed against a search service or search index.

• Document Actions: These actions query and manage the corpus for a given index

Index

CREATE -> POST /indexes?api-version=2014-07-31-Preview

UPDATE -> PUT /indexes/[index name]?api-version=2014-07-31-Preview

DELETE -> DELETE /indexes/[index name]?api-version=2014-07-31-Preview

GET -> GET /indexes/[index name]?api-version=2014-07-31-Preview

LIST -> GET /indexes?api-version=2014-07-31-Preview

Document

DML -> POST /indexes/[index name]/docs/index?api-version=2014-07-31-Preview

GET -> GET /indexes/[index name]/docs?[query parameters]

Lookup -> GET /indexes/[index name]/docs/[key]?[query parameters]

DML operating is use JSON column @search.action to declare action

"@search.action": "upload (default) | merge | mergeOrUpload | delete"

Service name conventions

Must be between 2 and 15 characters

Must start with a letter or number, followed by zero or more letters, numbers or dashes ('-')

Must be lowercase

Consecutive dashes are not allowed

Second character cannot be a dash

Don’t use dashes !!!

Index name conventions

Must be between 2 and 128 characters total

Must start with a letter or number, followed by zero or more letters, numbers

or dashes ('-')

Must be lowercase

Consecutive dashes are not allowed

Field name conventions

Must be between 1 and 128 characters

Can contain letters, numbers, and underscore ('_')

Must start with a letter

Cannot start with "azureSearch"

Document key naming conventions

Can contain letters, numbers, underscore ('_'), dashes ('-'), or equal sign ('=')

Cannot start with an underscore ('_')

If you use compound keys and need a separator, we recommend using '-', '_',

or '='.

If the keys in your source data contain characters other than the above, we

recommend encoding them using a URL-safe variant of Base64. For example,

in .NET you can use the HttpServerUtility.UrlTokenEncode method for this

purpose.

Cannot contain backslash ('\'), slash ('/'), or dot ('.')

If you use compound keys and need a separator, we recommend using |.

Tips

Increasing queries per second (QPS) or achieving high availability is done by

adding replicas

high availability need last three replicas

Replicas almost used in application

C# Azure Search

Using HttpClient

Header need have api-key

Use HttpRequestMessage send content

Data only use JSON

More example: https://azuresearchadventureworksdemo.codeplex.com/

You may need use NuGet console to updating MVC reference

Update-package -reinstall Microsoft.AspNet.Mvc