Skip to content

Circular Reference in JSON Serialization of Nest.DSL.Search.SearchSourceDescriptor<T> #706

@nariman-haghighi

Description

@nariman-haghighi

Here's the query:

  public IEnumerable<string> GetDocumentIds(Guid userId)
  {
      var queryResults = new ElasticClient(SearchSettings).Search<Media>(x => x
              .Index("Media")
              .Source(s => s.Include(m => m.Id))
              .Size(5000)
              .Query(p => p.Term(f => f.UserId, userId.ToString())));

      return queryResults.Documents.Select(m => m.Id);
  }

Exception: Newtonsoft.Json.JsonSerializationException: Self referencing loop detected for property 'self' with type 'Nest.DSL.Search.SearchSourceDescriptor`1[Data.Model.Media]'. Path '_source'.

The offending property seems to be in: NEST.ISearchRequest.Source

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions