Я пытаюсь проверить создание индекса, добавить документ и найти его с фильтром. Я получаю ошибку компилятора, которую я не могу решить. Спасибо за вашу помощь!Elasticsearch nest C# ошибка компилятора
Ошибка компилятора (VS 2013, консоли App):
"Выражение дерево не может содержать динамическую операцию."
Когда я дважды кликаю по ошибке, он выделяет «t.User» в строке .Filter кода.
Вот полный код.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Runtime.Remoting.Metadata.W3cXsd2001;
using System.Text;
using System.Threading.Tasks;
using Nest;
namespace elastic_search_client_app
{
class Post
{
public int Id;
public string User;
public DateTime PostDate;
public String Message;
}
class Program
{
static void Main(string[] args)
{
var uri = new Uri("http://es-server-name");
var settings = new ConnectionSettings(uri).SetDefaultIndex("stack-overflow-posts");
var client = new ElasticClient(settings);
var post = new Post() { Id = 2, User = "[email protected]", PostDate = DateTime.Now, Message = "This is pretty cool and lot of text stuff here from catalog summary collection" };
client.Index(post);
client.Refresh();
var result = client.Search<dynamic>(s => s
.Index("stack-overflow-posts")
.AllTypes()
.Query(q =>
q.QueryString(qs =>
qs.Query("cool")))
.Filter(f => f.Term(t => t.User, "[email protected]")));
}
}
}