Nest using system indices

(Marc Antoine Jutras) #1

Hi all,

I'm trying to get my cluster stats out of the .monitoring-* index with NEST and I can't get a result out so I was wondering if it does not allow querying system indices?

TermQuery termQuery = new TermQuery
     Field = "type",
     Value = "cluster_stats"
response = await _client.SearchAsync<ElasticClusterStat>(s => s
                                               .Query(q => q
                                                     .Term(tq => termQuery)


I set my connection to provide details (from OnRequestCompleted) and I can see the request (JSON) passed and there no hits in the result. When I copy paste my request in my kibana console, I get thousands of hits...


(Russ Cam) #2

I suspect you also need to set .Type(...) with the document type in the .monitoring indices

(Marc Antoine Jutras) #3

It did actually work! Why is that? The .Type(...) is always required? Isn't it going to be deprecated in 7.0.0 of elasticsearch?

Thanks @forloop

I was using the guide here: and it did not specify that the document type had to be specified for a query.

(Russ Cam) #4

Type is being deprecated, but it's still needed for 6.x.

In the absence of an explicit .Type() method call or any conventions set up on ConnectionSettings with

  • .DefaultTypeName()
  • ..DefaultTypeNameInferrer()
  • use of DataContractAttribute or ElasticsearchTypeAttribute on the POCO type

NEST infers the type name by lowercasing the POCO type name. Check out type inference for more details

(system) closed #5

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.