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
//oepn file and convert to base64 | |
FileStream inFile = System.IO.File.Open(@"c:\\testtest.docx", FileMode.OpenOrCreate, FileAccess.Read); | |
byte[] binaryData = new Byte[inFile.Length]; | |
inFile.Read(binaryData, 0, (int)inFile.Length); | |
inFile.Close(); | |
var base64String = System.Convert.ToBase64String(binaryData, 0, binaryData.Length); | |
//---------------------------------------------------------------------- | |
//create elasticsearch connect |
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
//Uri | |
http://localhost:9200/test1/_analyze?text='世界如此之大' | |
//Display Result | |
{ | |
"tokens": [ | |
{ | |
"token": "世界", |
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
//Uri | |
GET /test/person/_search | |
{ | |
"fields": [], | |
"query": { | |
"match": { | |
"file": "天氣" | |
} |
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
//URI | |
GET http://localhost:9200/test1/_mapping | |
(test1 is index) | |
//Result | |
{ | |
"test1": { | |
"mappings": { |
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
//Create Mapping | |
Uri : PUT | |
localhost:9200/test1/_mapping/testtype | |
(test1 is index) | |
(testtype is typename) | |
Json: | |
{ |
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
//Create Parent mapping | |
Uri:Put | |
http://localhost:9200/test1/_mapping/content | |
Json: | |
{ | |
"content" : { | |
"properties" : { |
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
Step1. | |
Uri:POST | |
http://localhost:9200/test/_close | |
========================================================================================================================================== | |
Step2. | |
Uri:PUT | |
http://localhost:9200/test/_settings |
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
//URI:POST | |
http://localhost:9200/11687/document/8132/_update?parent=6675 | |
11687 is index. | |
document is type. | |
8132 is documentId | |
//Json | |
{ |
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
<?xml version="1.0" encoding="utf-8"?> | |
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
android:orientation="vertical" | |
android:layout_width="fill_parent" | |
android:layout_height="fill_parent"> | |
<TextView | |
android:id="@+id/listCardTitle" | |
android:layout_width="fill_parent" | |
android:layout_alignParentTop="true" | |
android:layout_height="26dip" |
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
/** | |
* Flexible background positioning | |
* via extended background-position | |
*/ | |
div { | |
background: url(http://csssecrets.io/images/code-pirate.svg) | |
no-repeat bottom right #58a; | |
background-position: right 20px bottom 10px; | |
OlderNewer