| 145 | return self._set_with_state(key, value, None) |
| 146 | |
| 147 | def _index(self, id, body, **kwargs): |
| 148 | body = {bytes_to_str(k): v for k, v in body.items()} |
| 149 | if self.doc_type: |
| 150 | return self.server.index( |
| 151 | id=bytes_to_str(id), |
| 152 | index=self.index, |
| 153 | doc_type=self.doc_type, |
| 154 | body=body, |
| 155 | params={'op_type': 'create'}, |
| 156 | **kwargs |
| 157 | ) |
| 158 | else: |
| 159 | return self.server.index( |
| 160 | id=bytes_to_str(id), |
| 161 | index=self.index, |
| 162 | body=body, |
| 163 | params={'op_type': 'create'}, |
| 164 | **kwargs |
| 165 | ) |
| 166 | |
| 167 | def _update(self, id, body, state, **kwargs): |
| 168 | """Update state in a conflict free manner. |