Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to add meta field to aggregation? #598

Closed
Alkalit opened this issue Feb 20, 2017 · 1 comment
Closed

How to add meta field to aggregation? #598

Alkalit opened this issue Feb 20, 2017 · 1 comment

Comments

@Alkalit
Copy link

Alkalit commented Feb 20, 2017

According to official documentation I can add meta field to my aggregation

https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations.html#_structuring_aggregations

But when I'm trying:

# from
# https://www.elastic.co/guide/en/elasticsearch/reference/current/agg-metadata.html#agg-metadata
client = Search(using=haystack_connections['default'].get_backend().conn, index='haystack', doc_type='modelresult')

var = {
  "size": 0,
  "aggs": {
    "titles": {
      "terms": {
        "field": "title"
      },
      "meta": {
        "color": "blue"
      }
    }
  }
}

searcher = client.update_from_dict(var)

it raises an error:
ValueError: A() can only accept dict with an aggregation ({"terms": {...}}). Instead it got ({'terms': {'field': 'title'}, '_meta': {'color': 'blue'}})

@honzakral
Copy link
Contributor

This has been fixed in 5bcb9ba

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants