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

"query malformed, must start with start_object" exception when deleting by query #453

Open
Perlence opened this issue Aug 18, 2014 · 0 comments

Comments

@Perlence
Copy link

Hello,

I'm trying to delete documents by query:

>>> import pyes
>>> es = pyes.ES('http://localhost:9200')
>>> es.delete_by_query(['social'], ['post'], pyes.TermQuery('source_id', 38))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/ubuntu/Workspace/social/crawlers/env/local/lib/python2.7/site-packages/pyes/es.py", line 909, in delete_by_query
    return self._send_request('DELETE', path, body, query_params)
  File "/home/ubuntu/Workspace/social/crawlers/env/local/lib/python2.7/site-packages/pyes/es.py", line 470, in _send_request
    raise_if_error(response.status, decoded)
  File "/home/ubuntu/Workspace/social/crawlers/env/local/lib/python2.7/site-packages/pyes/convert_errors.py", line 67, in raise_if_error
    result, request)
pyes.exceptions.ElasticSearchException: Unknown exception type: 400, {'_indices': {'social': {'_shards': {'successful': 0, 'failed': 5, 'total': 5, 'failures': [{'index': 'social', 'reason': 'QueryParsingException[[social] [_na] query malformed, must start with start_object]', 'shard': 2}, {'index': 'social', 'reason': 'QueryParsingException[[social] [_na] query malformed, must start with start_object]', 'shard': 0}, {'index': 'social', 'reason': 'QueryParsingException[[social] [_na] query malformed, must start with start_object]', 'shard': 3}, {'index': 'social', 'reason': 'QueryParsingException[[social] [_na] query malformed, must start with start_object]', 'shard': 4}, {'index': 'social', 'reason': 'QueryParsingException[[social] [_na] query malformed, must start with start_object]', 'shard': 1}]}}}}

Post mapping is:

{
  "social": {
    "mappings": {
      "post": {
        "properties": {
          "comment_count": {
            "type": "integer"
          },
          "created_time": {
            "type": "date",
            "format": "dateOptionalTime"
          },
          "dislike_count": {
            "type": "integer"
          },
          "duration": {
            "type": "string",
            "index": "not_analyzed"
          },
          "favorite_count": {
            "type": "integer"
          },
          "like_count": {
            "type": "integer"
          },
          "link": {
            "type": "string",
            "index": "not_analyzed"
          },
          "location": {
            "type": "double"
          },
          "repost_count": {
            "type": "integer"
          },
          "social": {
            "type": "string",
            "index": "not_analyzed"
          },
          "source_id": {
            "type": "integer"
          },
          "text": {
            "type": "string"
          },
          "thumbnail": {
            "type": "string",
            "index": "not_analyzed"
          },
          "title": {
            "type": "string"
          },
          "user": {
            "type": "nested",
            "properties": {
              "bio": {
                "type": "string"
              },
              "created_time": {
                "type": "date",
                "format": "dateOptionalTime"
              },
              "first_name": {
                "type": "string",
                "index": "not_analyzed"
              },
              "full_name": {
                "type": "string",
                "index": "not_analyzed"
              },
              "gender": {
                "type": "string",
                "index": "not_analyzed"
              },
              "id": {
                "type": "string",
                "index": "not_analyzed"
              },
              "last_name": {
                "type": "string",
                "index": "not_analyzed"
              },
              "link": {
                "type": "string",
                "index": "not_analyzed"
              },
              "location": {
                "type": "string",
                "index": "not_analyzed"
              },
              "picture": {
                "type": "string",
                "index": "not_analyzed"
              },
              "username": {
                "type": "string",
                "index": "not_analyzed"
              },
              "website": {
                "type": "string",
                "index": "not_analyzed"
              }
            }
          },
          "view_count": {
            "type": "integer"
          }
        }
      }
    }
  }
}

Example post:

{
    "comment_count": 238,
    "created_time": "2014-04-21 14:17:50",
    "like_count": 925,
    "link": "...",
    "repost_count": 87,
    "social": "...",
    "source_id": 38,
    "text": "...",
    "thumbnail": "...",
    "user": {
        "full_name": "...",
        "id": "...",
        "link": "...",
        "username": "..."
    }
}
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

1 participant