0

I'll initial get dates from elastic stack. At first just any data set, just to proof it works. I set up the connection and than I try to get a data set. I show you my code and the error message below. You got any suggestions where to look for the missing values? Thanks, Frank

            string elasticSearchConnectionString = configuration.GetConnectionString("ElasticSearchConnection");
            string elasticSearchIndex = configuration.GetValue<string>("ElasticSearchIndex");
            Uri uri = new Uri(elasticSearchConnectionString);
            ConnectionSettings settings = new ConnectionSettings(uri).DefaultIndex(elasticSearchIndex);
            ElasticClient = new ElasticClient(settings);
            IGetResponse<_doc> result = ElasticClient.Get<_doc>(1);

IGetResponse<_doc> result = ElasticClient.Get<_doc>(1);

Invalid NEST response built from a unsuccessful low level call on GET: /hybif/_doc/1 Audit trail of this API call: - 1 BadResponse: Node: http://10.211.226.31:9200/ Took: 00:00:00.3149405 OriginalException: Elasticsearch.Net.ElasticsearchClientException: Request failed to execute. Call: Status code 404 from: GET /hybif/_doc/1

Request:

force it to be set on the response.>

Response:

ConnectionSettings to force it to be set on the response.>

00:00:00.3149405 OriginalException: Elasticsearch.Net.ElasticsearchClientException: Request failed to execute. Call: Status code 404 from: GET /hybif/_doc/1 Request: Response:

1 Answer 1

0

That works now...:

The search at my RecordsRepository.cs:

        var result = ElasticClient.Search<_doc>(document =>
            document
            .Query(q => q
                .Match(m => m
                    .Field(f => f.DataRecordId)
                    .Query(search)
                )
            )
        );

and the _doc.cs:

public class _doc
{
    [JsonProperty("contextName")]
    public string ContextName { get; set; }

    [JsonProperty("resourceId")]
    public string ResourceId { get; set; }

    [JsonProperty("componentId")]
    public string ComponentId { get; set; }

    [JsonProperty("processStepId")]
    public string ProcessStepId { get; set; }

    [JsonProperty("dataRecordId")]
    public long DataRecordId { get; set; }

    [JsonProperty("timestamp")]
    public object Timestamp { get; set; }

    [JsonProperty("value")]
    public double Value { get; set; }
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.