Skip to content

Instantly share code, notes, and snippets.

@jamilatta
Created October 29, 2015 17:39
Show Gist options
  • Save jamilatta/92cdb6ee49ce314e91a3 to your computer and use it in GitHub Desktop.
Save jamilatta/92cdb6ee49ce314e91a3 to your computer and use it in GitHub Desktop.
print 80 * '*'
print "Get Issues by journal using jid... using size=1000 ordenado por ano, volume e número"
print "O primeiro item do retorno é o issue mais recente"
s = Search(index=config.INDEX).query("match", journal_jid="e12fc1ffb85d4ec09b6fc60f9da56200").sort("-year", "-volume", "-number")
s = s[:1000] # Using from=0 and size=1000
r = s.execute()
for hit in r:
# print hit
print(hit.meta.score, hit.iid, hit.label, hit.year)
print "DSL: %s" % json.dumps(s.to_dict())
print "Elasticsearch_dsl: %s" % 'query("has_parent", parent_type="journal", query=Q("term", jid="e12fc1ffb85d4ec09b6fc60f9da56200"))'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment