mallocator/Elasticsearch-Exporter

Source query of type filter does not yield results

wkoot opened this issue · 3 comments

wkoot commented

If I use a source query with a filter such as { "filter": { "exists": { "field": "num" } } }, no results are found (nor exported).
This does return data when curling, i.e. curl -XPOST localhost:9200/test_index/_search -d '{ "filter": { "exists": { "field": "num" } } }' does return data.

With exporter 1.4.0:

Elasticsearch Exporter - Version 1.4.0
Reading source statistics from ElasticSearch
Reading mapping from ElasticSearch
Creating index mapping in target ElasticSearch instance
Mapping is now ready. Starting with 0 queued hits.

With exporter 2.0.0:

Elasticsearch Exporter - Version 2.0.0
The driver reported an error: The source driver has not reported any documents that can be exported. Not exporting.
Exit code 4: driver is passing on an error
Fetched Entries:        0 documents
Processed Entries:      0 documents
Source DB Size:         0 documents

Not sure what query you're trying to do here, the parameter that you pass in is what you would insert into the query property of a search request. As such I assume that this would work:

{ 
  "filtered": { 
    "query": { 
      "match_all": {} 
    }, 
    "filter": { 
      "exists": { 
         "field": "num"
      }
    } 
  }
}

I haven't tried the query, just going after the docs

wkoot commented

I tried that and it does not work, which is why I reported it

in your example you're leaving out the "filtered" object that wraps the "query" and "filter" object.

You're query is passed in as is to a scroll request, so if that doesn't help then I don't know what else I can do.