Last active
August 29, 2015 14:05
-
-
Save gaubert/0bf785679a89a419fa30 to your computer and use it in GitHub Desktop.
working elastic search query with highlight and facets
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# working query with highlight and facets first | |
curl -XGET 'http://localhost:9200/_search?pretty=true' -d ' | |
{ "from" : 0, "size" : 1, | |
"highlight" : { | |
"fields" : | |
{ "identificationInfo.title": {"fragment_size":150,"number_of_fragments":3}, "identificationInfo.abstract": {} } | |
} , | |
"facets" : | |
{ | |
"satellites_global": | |
{ | |
"terms" : { | |
"field" : "hierarchyNames.satellite" | |
}, | |
"global" : true | |
}, | |
"instruments_global": | |
{ | |
"terms" : { | |
"field" : "hierarchyNames.instrument" | |
}, | |
"global" : true | |
} | |
}, | |
"query" : { | |
"filtered" : | |
{ | |
"query" : | |
{ | |
"simple_query_string" : | |
{ | |
"fields" : ["identificationInfo.title^10", "identificationInfo.abstract"], | |
"query" : "iasi" | |
}, | |
"filter" : | |
{ | |
"terms" : | |
{ | |
"hierarchyNames.instrument" : [ "iasi" ] | |
} | |
} | |
} | |
} | |
} | |
} | |
' | |
# result providing all the information highlight and facets included | |
{ | |
"took" : 2, | |
"timed_out" : false, | |
"_shards" : { | |
"total" : 5, | |
"successful" : 5, | |
"failed" : 0 | |
}, | |
"hits" : { | |
"total" : 10, | |
"max_score" : 4.9318256, | |
"hits" : [ { | |
"_index" : "eumetsat-catalogue", | |
"_type" : "product", | |
"_id" : "EO:EUM:DAT:METOP:IASIL1C-ALL", | |
"_score" : 4.9318256, "_source" : {"identificationInfo":{"abstract":"This product covers all spectral samples. The main objective of the Infrared Atmospheric Sounding Interferometer (IASI) is to provide high resolution atmospheric emission spectra to derive temperature and humidity profiles with high spectral and vertical resolution and accuracy. Additionally it is used for the determination of trace gases such as ozone, nitrous oxide, carbon dioxide and methane, as well as land and sea surface temperature, emissivity and cloud properties. The IASI L1c product contains infra-red radiance spectra at 0.5cm-1 resolution. The EUMETCast product has for each sounder pixel 8461 spectral samples covering the range between 645.0 cm-1 and 2760 cm-1.","title":"IASI GDS Level 1C - all spectral samples - Metop","keywords":["Atmospheric conditions","Weather","Level 1 Data","Atmosphere","EUMETSAT Data Centre","EUMETCast-Europe","EUMETCast"],"status":"Operational"},"hierarchyNames":{"satellite":"METOP","category":["Level_1_Data","Atmosphere","GEONETCast"],"societalBenefitArea":["Weather"],"instrument":"IASI","distribution":["EUMETSATArchive","EUMETCast-Europe","EUMETCast"]},"location":{"type":"envelope","coordinates":[[-180.0,90.0],[180.0,-90.0]]},"contact":{"address":"EUMETSAT Allee 1\n64295 Darmstadt\nHessen\nGermany","email":"[email protected]"},"fileIdentifier":"EO:EUM:DAT:METOP:IASIL1C-ALL"}, | |
"highlight" : { | |
"identificationInfo.title" : [ "<em>IASI</em> GDS Level 1C - all spectral samples - Metop" ], | |
"identificationInfo.abstract" : [ " Interferometer (<em>IASI</em>) is to provide high resolution atmospheric emission spectra to derive", ", as well as land and sea surface temperature, emissivity and cloud properties. The <em>IASI</em> L1c product" ] | |
} | |
} ] | |
}, | |
"facets" : { | |
"satellites_global" : { | |
"_type" : "terms", | |
"missing" : 98, | |
"total" : 402, | |
"other" : 0, | |
"terms" : [ { | |
"term" : "sat", | |
"count" : 304 | |
}, { | |
"term" : "metop", | |
"count" : 86 | |
}, { | |
"term" : "jason", | |
"count" : 8 | |
}, { | |
"term" : "2", | |
"count" : 4 | |
} ] | |
}, | |
"instruments_global" : { | |
"_type" : "terms", | |
"missing" : 408, | |
"total" : 92, | |
"other" : 11, | |
"terms" : [ { | |
"term" : "seviri", | |
"count" : 16 | |
}, { | |
"term" : "gome2", | |
"count" : 15 | |
}, { | |
"term" : "avhrr", | |
"count" : 14 | |
}, { | |
"term" : "ascat", | |
"count" : 14 | |
}, { | |
"term" : "iasi", | |
"count" : 10 | |
}, { | |
"term" : "poseidon", | |
"count" : 3 | |
}, { | |
"term" : "3", | |
"count" : 3 | |
}, { | |
"term" : "mhs", | |
"count" : 2 | |
}, { | |
"term" : "hirs", | |
"count" : 2 | |
}, { | |
"term" : "gras", | |
"count" : 2 | |
} ] | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment