Tests.QueryDSLTests.TestCustomScoreQuery C# (CSharp) Method

TestCustomScoreQuery() private method

private TestCustomScoreQuery ( ) : void
return void
		public void TestCustomScoreQuery()
		{
			//age 23 24 25
			var query = new TermQuery("type", "common");
			var dict = new Dictionary<string, object>();
			dict["param1"] = 0.2;
			var script = "_score + doc['age'].value - param1";
			var q = new CustomScoreQuery(query, script, dict);
			var result = client.Search(index, "type", q, 0, 5);
			foreach (var o in result.GetHits().Hits)
			{
				Console.WriteLine(o.ToString());
			}
			Assert.AreEqual("张",result.GetHits().Hits[0].Source["name"]);
		}