0

I have got the following document:

"_index": String,
"_type": String,
"_id": String,
"_source": {
    "id": String
    "sendDate": Date
    "title": String
    "author": String
    "language": String
    "keywords": Array<String>
}

I would like list and count every single keyword from whole type from database. Have you maybe any tips for me?

3
  • I created sth like below { "size": 0, "aggs": { "item": { "terms": { "field": "keyWords","size": 1000000 } }, "total_terms": { "cardinality": { "field": "keyWords" } } } } but it shows only single words, sometimes keyword is built from a few words Commented Aug 14, 2017 at 11:32
  • it would be great if you edit your question and add the result you get and the result you expect. Commented Aug 14, 2017 at 11:49
  • @TarasKohut Sure, i ll post answer Commented Aug 14, 2017 at 11:58

1 Answer 1

1

So here is the answer

{
      "size": 0,
      "aggs": {
        "item": {
          "terms": {
            "field": "keyWords.raw",
            "size": 1000000
          }
        },
        "total_terms": {
          "cardinality": {
                "field": "keyWords.raw"
          }
        }
      }
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.