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);
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:
答案 0 :(得分:0)
现在可以使用...:
在我的RecordsRepository.cs中进行搜索:
var result = ElasticClient.Search<_doc>(document =>
document
.Query(q => q
.Match(m => m
.Field(f => f.DataRecordId)
.Query(search)
)
)
);
和_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; }
}