Tests.QueryDSLTests.Init C# (CSharp) Method

Init() private method

private Init ( ) : void
return void
		public void Init()
		{
			var typesetting = new TypeSetting("type");
			typesetting.AddFieldSetting("name", new StringFieldSetting() { Index = IndexType.not_analyzed });
			typesetting.AddFieldSetting("id", new NumberFieldSetting() { });
			typesetting.AddFieldSetting("gender", new BooleanFieldSetting() { Index = IndexType.not_analyzed });

			client.CreateIndex(index);
			client.PutMapping(index, typesetting);

			IndexItem item;
			for (int i = 0; i < 100; i++)
			{
				item = new IndexItem("type", i.ToString());
				item.Add("name", Guid.NewGuid().ToString());
				item.Add("id", i);
				item.Add("ids","ids_{0}".Fill(i));
				if (i >= 50)
				{
					item.Add("gender", true);
				}
				else
				{
					item.Add("gender", false);
				}
	
			
			client.Index(index,item);
			}


			item = new IndexItem("type", "addition_key2");
			item.Add("name", "张");
			item.Add("age",25);
			item.Add("type","common");
			client.Index(index, item);

			item = new IndexItem("type", "addition_key3");
			item.Add("name", "张三");
			item.Add("age", 24);
			item.Add("type", "common");
			client.Index(index, item);

			item = new IndexItem("type", "addition_key4");
			item.Add("name", "张三丰");
			item.Add("age", 23);
			item.Add("type", "common");
			client.Index(index, item);

			item = new IndexItem("type", "addition_key5");
			item.Add("name", "二张三张");
			item.Add("age", 22);
			item.Add("type", "common2");
			client.Index(index, item);

			Thread.Sleep(1000);
		}