title: Celery Result type for ElasticSearch
body: <p>I'm exploring celery for my work currently and I'm trying to set-up Elasticsearch backend. Is there any way to send resulting value as a dictionary/JSON, not as a text? Therefore, results in Elasticsearch will be shown correctly and nested type could be used? </p>
  
  <p><a href="https://i.stack.imgur.com/Mu2CJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Mu2CJ.png" alt="enter image description here"></a></p>
  
  <p>Automatic mapping created by celery</p>
  
  <pre><code>{
    "celery" : {
      "mappings" : {
        "backend" : {
          "properties" : {
            "@timestamp" : {
              "type" : "date"
            },
            "result" : {
              "type" : "text",
              "fields" : {
                "keyword" : {
                  "type" : "keyword",
                  "ignore_above" : 256
                }
              }
            }
          }
        }
      }
    }
  }
  </code></pre>
  
  <p>I've tried to create my own mapping with nested field, but it has resulted in a <code>elasticsearch.exceptions.RequestError: RequestError(400, 'mapper_parsing_exception', 'object mapping for [result] tried to parse field [result] as object, but found a concrete value')
  </code></p>
  
  <p>UPDATE </p>
  
  <p>Result is already encoded in JSON and inside Elasticsearch wrapper JSON string is saved inside a dictionary. Adding <code>json.loads(result)</code> as a quick-fix actually helps.</p>
  
  <p>After the quick-fix new mapping has appeared:</p>
  
  <pre><code>{
    "celery" : {
      "mappings" : {
        "backend" : {
          "properties" : {
            "@timestamp" : {
              "type" : "date"
            },
            "result" : {
              "properties" : {
                "date_done" : {
                  "type" : "date"
                },
                "result" : {
                  "type" : "long"
                },
                "status" : {
                  "type" : "text",
                  "fields" : {
                    "keyword" : {
                      "type" : "keyword",
                      "ignore_above" : 256
                    }
                  }
                },
                "task_id" : {
                  "type" : "text",
                  "fields" : {
                    "keyword" : {
                      "type" : "keyword",
                      "ignore_above" : 256
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
  
  </code></pre>
  
  <p>Updated Kibana view:
  <a href="https://i.stack.imgur.com/MF4DD.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MF4DD.png" alt="enter image description here"></a></p>
  
  <p><strong>Is there any way to disable serialization of results in Celery?</strong></p>
  
  <p>I could add a pull-request with unpacking JSON, just for Elasticsearch, but it looks like a hack.</p>