Aggregation-keywords

Dear All,

What does term and keyword mean that are used in aggregation query,

Please find the example below

GET /bank/_search
{
"size": 0,
"aggs": {
"group_by_state": {
"terms": {
"field": "state.keyword"
},
"aggs": {
"average_balance": {
"avg": {
"field": "balance"
}
}
}
}
}
}

I guess you meant terms and state.keyword.

If you are not defining any mapping in elasticsearch, then elasticsearch tries to automatically guess the mapping for you. If you sent a text within a state field, then elasticsearch created 2 fields behind the scene state and state.keyword. The former is more for full text search, the later more for computing aggregations, do sorting...

You can look at the mapping by doing:

GET /bank/_mapping

what does that multi-bucket value source based aggregation mean ,i don't understand
terms : that's a terms aggregation,bucket.And in some cases we done use state.keyword why its is .Please explain.I just now started to learn elasticsearch

I don't understand the question.

Could you provide a full recreation script as described in About the Elasticsearch category. It will help to better understand what you are doing. Please, try to keep the example as simple as possible.

Then from that tell me what you don't understand.

What does 'terms' and 'keyword' mean used in aggregation script for example see below example.And then don't understand the concept given in the above link given b you

GET /bank/_search
{
"size": 0,
"aggs": {
"group_by_state": {
"terms": {
"field": "state.keyword"
},
"aggs": {
"average_balance": {
"avg": {
"field": "balance"
}
}
}
}
}
}

I already answered to this question here: Aggregation-keywords

I don't understand what you don't understand in my answer.

May be someone else understand what the problem is?

When should we use aggregation keyword

There's no keyword aggregation if this is what you meant.

You need to run aggregation on fields which have a keyword datatype.

Thank You so much for this post... psiphon

Dear David.

state.keyword in this "state" is a field and why does we use "keyword" word that is as
field.keyword

In case you missed what I explained earlier:

If you are not defining any mapping in elasticsearch, then elasticsearch tries to automatically guess the mapping for you. If you sent a text within a state field, then elasticsearch created 2 fields behind the scene state and state.keyword . The former is more for full text search, the later more for computing aggregations, do sorting...

You can look at the mapping by doing:

GET /bank/_mapping

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.