Sum of total term frequency in ONE document

I need sumttf of ONE document in a field. However I can get sumttf of all
documents only...
I need to be able to access the variable in script like
_index['field'].sumttf() of that particular document. This is what I've got
so far.

Mapping:

{"document2" : {
  "mappings" : {
    "document2" : {
      "_all" : {
        "enabled" : false
      },
      "properties" : {
        "content" : {
          "type" : "string",
          "term_vector" : "yes",
          "fields" : {
            "with_shingles" : {
              "type" : "string",
              "analyzer" : "my_shingle_analyzer"
            }
          }
        },
        ...

Term vector:

"_index" : "document2",
"_type" : "document2",
"_id" : "709718",
"_version" : 1,
"term_vectors" : {
    "content" : {
      "field_statistics" : {
        "sum_doc_freq" : 60676474,
        "doc_count" : 198373,
        "sum_ttf" : 224960172
      },
      terms" : {
        "0" : {
          "term_freq" : 8
        },
        "0.5" : {
          "term_freq" : 1
        },
        "003a0e45ea07a" : {
          "term_freq" : 1
        },
        "005" : {
          "term_freq" : 1
        },
        "0081989" : {
          "term_freq" : 1
        },
        "01" : {
          "term_freq" : 1
        },
        "01.08.2002" : {
          "term_freq" : 1
        },
        ...

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/b9afb2c4-bde4-4c60-b026-aa2c24227c03%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hi ,

Why dont you use script fields to access this value -
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-script-fields.html#search-request-script-fields

Thanks
Vineeth

On Wed, Dec 17, 2014 at 2:57 PM, valerij.vasilcenko@googlemail.com wrote:

I need sumttf of ONE document in a field. However I can get sumttf of all
documents only...
I need to be able to access the variable in script like
_index['field'].sumttf() of that particular document. This is what I've got
so far.

Mapping:

{"document2" : {
  "mappings" : {
    "document2" : {
      "_all" : {
        "enabled" : false
      },
      "properties" : {
        "content" : {
          "type" : "string",
          "term_vector" : "yes",
          "fields" : {
            "with_shingles" : {
              "type" : "string",
              "analyzer" : "my_shingle_analyzer"
            }
          }
        },
        ...

Term vector:

"_index" : "document2",
"_type" : "document2",
"_id" : "709718",
"_version" : 1,
"term_vectors" : {
    "content" : {
      "field_statistics" : {
        "sum_doc_freq" : 60676474,
        "doc_count" : 198373,
        "sum_ttf" : 224960172
      },
      terms" : {
        "0" : {
          "term_freq" : 8
        },
        "0.5" : {
          "term_freq" : 1
        },
        "003a0e45ea07a" : {
          "term_freq" : 1
        },
        "005" : {
          "term_freq" : 1
        },
        "0081989" : {
          "term_freq" : 1
        },
        "01" : {
          "term_freq" : 1
        },
        "01.08.2002" : {
          "term_freq" : 1
        },
        ...

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/b9afb2c4-bde4-4c60-b026-aa2c24227c03%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/b9afb2c4-bde4-4c60-b026-aa2c24227c03%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAGdPd5nx2PZbAp%2BL732sShWY82Bhthurs8nPL_Ck3gG13uPhZQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.