Created
November 11, 2015 21:23
-
-
Save yusukegoto/fe2998e9b1985759a6af to your computer and use it in GitHub Desktop.
search.cs
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
using Nest; | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using System.Windows; | |
using System.Windows.Controls; | |
using System.Windows.Data; | |
using System.Windows.Documents; | |
using System.Windows.Input; | |
using System.Windows.Media; | |
using System.Windows.Media.Imaging; | |
using System.Windows.Navigation; | |
using System.Windows.Shapes; | |
namespace NestTester | |
{ | |
/// <summary> | |
/// MainWindow.xaml の相互作用ロジック | |
/// </summary> | |
public partial class MainWindow : Window | |
{ | |
public MainWindow() | |
{ | |
InitializeComponent(); | |
// var uri = new Uri("http://vps2.fellowrobots.com:9201/products-jp/product"); | |
var uri = new Uri("http://vps2.fellowrobots.com:9201"); | |
var setting = new ConnectionSettings(uri) | |
.SetBasicAuthentication("oshbot", "ydfn1248"); | |
var client = new ElasticClient(setting); | |
var query = new SearchDescriptor<Product>() | |
.Index("products-jp") | |
.Type("product") | |
.Query(pp => pp.Term(ppp => ppp .Name, "sony")); | |
var res = client.Search<Product>(query); | |
comboBox.ItemsSource = res.Hits.Select(product => product.Source.Name); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment