[gdal-dev] How to read ElasticSearch filters from file?
Even Rouault
even.rouault at spatialys.com
Tue Oct 6 02:03:24 PDT 2015
Le jeudi 27 août 2015 14:43:39, Even Rouault a écrit :
> Le jeudi 27 août 2015 14:26:00, Jukka Rahkonen a écrit :
> > Hi,
> >
> > I was trying the new read capabilities of the ElasticSearch driver
> > http://www.gdal.org/drv_elasticsearch.html and I found it extraordinary
> > hard to use the json filters from the command line on Windows. It is hard
> > also with curl so I saved the filters on disk and read them as -d
> > @file.json and that worked well for me.
> >
> > I tried if I could re-use those proved filters with ogrinfo and ogr2ogr
> > by using --optfile but with poor success.
> >
> > Could it be possible to add a new --config option or perhaps -oo open
> > option "ES_QUERY" for reading the json query/filter from a file just like
> > curl does with -d @file.json? The same file should work unmodified for
> > both software. I think especially newlines which make the filters more
> > readable and also most filter examples in the net are formatted with
> > newlines. See the examples at
> > https://www.elastic.co/guide/en/elasticsearch/guide/current/search-in-dep
> > th .html
>
> Hi Jukka,
>
> Ah, might be true. The Unix shell allows to paste things like:
>
> $ ogrinfo es: poly2 -where '{ "filter" :
> { "term" :
> {
> "EAS_ID": 166
> }
> }
> }'
>
> And --optfile indeed will consider stuff on several lines as different
> options.
>
> What about "ogrinfo ES: the_layer -where @filter.json" ?
FYI, I've just implemented this syntax for -where and -sql in ogrinfo and
ogr2ogr.
Even
--
Spatialys - Geospatial professional services
http://www.spatialys.com
More information about the gdal-dev
mailing list