Skip to content

Instantly share code, notes, and snippets.

@wflanagan
Created January 16, 2020 13:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wflanagan/7ebf52bf0693f4462256dab8785c9baa to your computer and use it in GitHub Desktop.
Save wflanagan/7ebf52bf0693f4462256dab8785c9baa to your computer and use it in GitHub Desktop.
## This should return hits, it doesn't.
curl -XGET "http://localhost:9200/mentions_production/_search" -H 'Content-Type: application/json' -d'{ "query": { "term": {"references": "publisher/profile:mumo.beaplumbereducationok.rocks"} }}'
## If you do the query adding the aggs, it then errors wtih a fielddata error
curl -XGET "http://localhost:9200/mentions_production/_search" -H 'Content-Type: application/json' -d'{ "query": { "term": {"references": "publisher/profile:mumo.beaplumbereducationok.rocks"} }, "aggs": { "friendly_ids": { "terms": { "field": "references" } } }}'
## This one retrieves correctly
curl -XGET "http://localhost:9200/mentions_production/_search" -H 'Content-Type: application/json' -d'{ "query": { "bool": { "must": { "match": {"references": "publisher/profile:mumo.beaplumbereducationok.rocks"} } } }}'
## This one errors when you add the aggs to it
curl -XGET "http://localhost:9200/mentions_production/_search" -H 'Content-Type: application/json' -d'{ "query": { "bool": { "must": { "match": {"references": "publisher/profile:mumo.beaplumbereducationok.rocks"} } } }, "aggs": { "friendly_ids": { "terms": { "field": "references" } } }}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment