# Help With Elasticsearch DSL MultiMatch Not Working with Searching Through Text and Integer Doc Types? Transport Error 400

**URL:** <https://discuss.elastic.co/t/help-with-elasticsearch-dsl-multimatch-not-working-with-searching-through-text-and-integer-doc-types-transport-error-400/104857>\
**Category:** Elasticsearch\
**Created:** [October 23, 2017, 8:04am UTC](https://discuss.elastic.co/t/help-with-elasticsearch-dsl-multimatch-not-working-with-searching-through-text-and-integer-doc-types-transport-error-400/104857 "2017-10-23T08:04:17Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![thejeffchen](https://avatars.discourse-cdn.com/v4/letter/t/958977/32.png) [@thejeffchen](https://discuss.elastic.co/u/thejeffchen)\
**Post date:** [October 23, 2017, 8:04am UTC](https://discuss.elastic.co/t/help-with-elasticsearch-dsl-multimatch-not-working-with-searching-through-text-and-integer-doc-types-transport-error-400/104857/1 "2017-10-23T08:04:17Z")

</div>

Hey everyone,

I'm having trouble getting the elasticsearch DSL to search through text and integer doc types. If I only do the fields with text() or integer(), there is no problem, but when I try to get elasticsearch to search through both types, I have an issue.

Multimatch code:

```
   elastic_search_query = ProfileDocument.search().query("multi_match",
       query=query,
       fields=[
               'name',
               'city',
               'state',
               'country',
               'job_title',
               'company',
               'id'
           ])

class ProfileDocument(DocType):
name = Text()
city = Text()
state = Text()
country = Text()
job_title = Text()
company = Text()
id = Integer()

```

ID is the only one that is integer(), the other fields are all text(). If I removed ID, it works fine.

I get this error:  
TransportError(400, 'search\_phase\_execution\_exception', 'failed to create query: {\n "multi\_match" : {\n "query" : "asdf",\n "fields" : [\n "city^1.0",\n "company^1.0",\n "country^1.0",\n "id^1.0",\n "job\_title^1.0",\n "name^1.0",\n "state^1.0"\n],\n "type" : "best\_fields",\n "operator" : "OR",\n "slop" : 0,\n "prefix\_length" : 0,\n "max\_expansions" : 50,\n "lenient" : false,\n "zero\_terms\_query" : "NONE",\n "boost" : 1.0\n }\n}')

I also tried it with MultiSearch:

```
    client = Elasticsearch()
    ms = MultiSearch(using=client, index='profile')

    ms = ms.add(Search().filter('term', id=query))
    ms = ms.add(Search().query('match', name=query))
    ms = ms.add(Search().query('match', city=query))
    ms = ms.add(Search().query('match', state=query))

    elastic_search_query = ms.execute()

    print(elastic_search_query)

```

This also pulls a TransportError when ID is included, but not when the other types are included.

I've been searching for hours on this issue and reviewed tons of stackoverflow things and the elasticsearch dsl video here, but couldn't find the answer anywhere: [https://www.youtube.com/watch?v=hE359wuHyhs&t=191s](https://www.youtube.com/watch?v=hE359wuHyhs&t=191s)

I think it should make sense what I'm doing, but I'm not entirely sure. Can anyone provide insight or help?

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [October 23, 2017, 8:53am UTC](https://discuss.elastic.co/t/help-with-elasticsearch-dsl-multimatch-not-working-with-searching-through-text-and-integer-doc-types-transport-error-400/104857/2 "2017-10-23T08:53:18Z")

</div>

can you provide the full HTTP request and the full stack trace in the elasticsearch logs?

---

<div class="post-metadata">

**Author:** ![thejeffchen](https://avatars.discourse-cdn.com/v4/letter/t/958977/32.png) [@thejeffchen](https://discuss.elastic.co/u/thejeffchen)\
**Post date:** [October 24, 2017, 3:22am UTC](https://discuss.elastic.co/t/help-with-elasticsearch-dsl-multimatch-not-working-with-searching-through-text-and-integer-doc-types-transport-error-400/104857/3 "2017-10-24T03:22:45Z")

</div>

**Stacktrace:**

Internal Server Error: /jeff-chen-11648/  
Traceback (most recent call last):  
File "/usr/local/lib/python3.6/site-packages/django/core/handlers/exception.py", line 41, in inner  
response = get\_response(request)  
File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py", line 187, in \_get\_response  
response = self.process\_exception\_by\_middleware(e, request)  
File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py", line 185, in \_get\_response  
response = wrapped\_callback(request, \*callback\_args, \*\*callback\_kwargs)  
File "/Users/jeffchen/PycharmProjects/jeffchenseo/jeffchenseo/src/votes/views.py", line 70, in index  
for each\_hit in elastic\_search\_query:  
File "/usr/local/lib/python3.6/site-packages/elasticsearch\_dsl/search.py", line 252, in **iter**  
return iter(self.execute())  
File "/usr/local/lib/python3.6/site-packages/elasticsearch\_dsl/search.py", line 606, in execute  
\*\*self.\_params  
File "/usr/local/lib/python3.6/site-packages/elasticsearch/client/utils.py", line 73, in \_wrapped  
return func(\*args, params=params, \*\*kwargs)  
File "/usr/local/lib/python3.6/site-packages/elasticsearch/client/ **init**.py", line 623, in search  
doc\_type, '\_search'), params=params, body=body)  
File "/usr/local/lib/python3.6/site-packages/elasticsearch/transport.py", line 312, in perform\_request  
status, headers, data = connection.perform\_request(method, url, params, body, ignore=ignore, timeout=timeout)  
File "/usr/local/lib/python3.6/site-packages/elasticsearch/connection/http\_urllib3.py", line 128, in perform\_request  
self.\_raise\_error(response.status, raw\_data)  
File "/usr/local/lib/python3.6/site-packages/elasticsearch/connection/base.py", line 125, in \_raise\_error  
raise HTTP\_EXCEPTIONS.get(status\_code, TransportError)(status\_code, error\_message, additional\_info)  
elasticsearch.exceptions.RequestError: TransportError(400, 'search\_phase\_execution\_exception', 'failed to create query: {\n "multi\_match" : {\n "query" : "asdf",\n "fields" : [\n "city^1.0",\n "company^1.0",\n "country^1.0",\n "id^1.0",\n "job\_title^1.0",\n "name^1.0",\n "state^1.0"\n],\n "type" : "best\_fields",\n "operator" : "OR",\n "slop" : 0,\n "prefix\_length" : 0,\n "max\_expansions" : 50,\n "lenient" : false,\n "zero\_terms\_query" : "NONE",\n "boost" : 1.0\n }\n}')

**Http request:**

Apple\_PubSub\_Socket\_Render   
'/private/tmp/com.apple.launchd.vqyDBLLUcq/Render'  
BOLD   
'\x1b[1m'  
COLORFGBG   
'12;8'  
COMMAND\_MODE   
'unix2003'  
CONTENT\_LENGTH   
''  
CONTENT\_TYPE   
'text/plain'  
CSRF\_COOKIE   
'x7zsGtPH9K6HO5Td85w0ihNNGj5UbpHcTIqg6rm6Se3Q0K0OADOXgsrhOtZdZMCq'  
DJANGO\_SETTINGS\_MODULE   
'jeffchenseo.settings'  
GATEWAY\_INTERFACE   
'CGI/1.1'  
GEM\_HOME   
'/Users/jeffchen/.rvm/gems/ruby-2.4.0'  
GEM\_PATH   
'/Users/jeffchen/.rvm/gems/ruby-2.4.0:/Users/jeffchen/.rvm/gems/ruby-2.4.0@global'  
GREEN   
'\x1b[38;5;64m'  
HOME   
'/Users/jeffchen'  
HTTP\_ACCEPT   
'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,_/_;q=0.8'  
HTTP\_ACCEPT\_ENCODING   
'gzip, deflate, br'  
HTTP\_ACCEPT\_LANGUAGE   
'en-US,en;q=0.8'  
HTTP\_CACHE\_CONTROL   
'no-cache'  
HTTP\_CONNECTION   
'keep-alive'  
HTTP\_COOKIE   
('djdt=hide; sessionid=kc6zgc2bj1vh6s1a0q5p2z7acxy2qcjc; '  
'csrftoken=x7zsGtPH9K6HO5Td85w0ihNNGj5UbpHcTIqg6rm6Se3Q0K0OADOXgsrhOtZdZMCq; '  
'\_ga=GA1.1.1653284646.1507506355; \_gid=GA1.1.718168838.1508558352; \_gat=1; '  
'\_\_atuvc=31%7C42%2C109%7C43; \_\_atuvs=59eead86d81fa830000')  
HTTP\_HOST   
'127.0.0.1:8000'  
HTTP\_PRAGMA   
'no-cache'  
HTTP\_REFERER   
'[http://127.0.0.1:8000/jeff-chen-11648/](http://127.0.0.1:8000/jeff-chen-11648/)'  
HTTP\_UPGRADE\_INSECURE\_REQUESTS   
'1'  
HTTP\_USER\_AGENT   
('Mozilla/5.0 (Macintosh; Intel Mac OS X 10\_12\_6) AppleWebKit/537.36 (KHTML, '  
'like Gecko) Chrome/61.0.3163.100 Safari/537.36')  
IRBRC   
'/Users/jeffchen/.rvm/rubies/ruby-2.4.0/.irbrc'  
ITERM\_PROFILE   
'Jeff'  
ITERM\_SESSION\_ID   
'w0t0p0:A9F167CF-61B6-4F36-9B22-97FD86E90A95'  
LANG   
'en\_US.UTF-8'  
LOGNAME   
'jeffchen'  
LS\_COLORS   
'no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:_.tar=01;31:_.tgz=01;31:_.arj=01;31:_.taz=01;31:_.lzh=01;31:_.zip=01;31:_.z=01;31:_.Z=01;31:_.gz=01;31:_.bz2=01;31:_.deb=01;31:_.rpm=01;31:_.jar=01;31:_.jpg=01;35:_.jpeg=01;35:_.gif=01;35:_.bmp=01;35:_.pbm=01;35:_.pgm=01;35:_.ppm=01;35:_.tga=01;35:_.xbm=01;35:_.xpm=01;35:_.tif=01;35:_.tiff=01;35:_.png=01;35:_.mov=01;35:_.mpg=01;35:_.mpeg=01;35:_.avi=01;35:_.fli=01;35:_.gl=01;35:_.dl=01;35:_.xcf=01;35:_.xwd=01;35:_.ogg=01;35:_.mp3=01;35:_.wav=01;35:'  
MAGENTA   
'\x1b[38;5;125m'  
MY\_RUBY\_HOME   
'/Users/jeffchen/.rvm/rubies/ruby-2.4.0'  
OLDPWD   
'/Users/jeffchen/PycharmProjects/jeffchenseo/jeffchenseo'  
ORANGE   
'\x1b[38;5;166m'  
PATH   
'/Users/jeffchen/PycharmProjects/jeffchenseo/jeffchenseo\_env/bin:/Users/jeffchen/.rvm/gems/ruby-2.4.0/bin:/Users/jeffchen/.rvm/gems/ruby-2.4.0@global/bin:/Users/jeffchen/.rvm/rubies/ruby-2.4.0/bin:/Users/jeffchen/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/MacGPG2/bin:/Users/jeffchen/.rvm/bin'  
PATH\_INFO   
'/jeff-chen-11648/'  
PS1   
('(jeffchenseo\_env) \[\x1b[1m\x1b[38;5;125m\]\u \[\x1b[38;5;244m\]at '  
'\[\x1b[38;5;166m\]\h \[\x1b[38;5;244m\]in '  
'\[\x1b[38;5;64m\]\w\[\x1b[38;5;244m\]$([[ -n $(git branch 2\> /dev/null) '  
']] && echo " on '  
'")\[\x1b[38;5;61m\]$(parse\_git\_branch)\[\x1b[38;5;244m\]\n$ '  
'\[\x1b(B\x1b[m\]')  
PS2   
'\[\x1b[38;5;166m\]→ \[\x1b(B\x1b[m\]'  
PURPLE   
'\x1b[38;5;61m'  
PWD   
'/Users/jeffchen/PycharmProjects/jeffchenseo/jeffchenseo/src'  
QUERY\_STRING   
'q=asdf'  
REMOTE\_ADDR   
'127.0.0.1'  
REMOTE\_HOST   
''  
REQUEST\_METHOD   
'GET'  
RESET   
'\x1b(B\x1b[m'  
RUBY\_VERSION   
'ruby-2.4.0'  
RUN\_MAIN   
'true'  
SCRIPT\_NAME   
''  
SECURITYSESSIONID   
'186a8'  
SERVER\_NAME   
'1.0.0.127.in-addr.arpa'  
SERVER\_PORT   
'8000'  
SERVER\_PROTOCOL   
'HTTP/1.1'  
SERVER\_SOFTWARE   
'WSGIServer/0.2'  
SHELL   
'/bin/bash'  
SHLVL   
'1'  
SSH\_AUTH\_SOCK   
'/private/tmp/com.apple.launchd.D1eAxZZGAx/Listeners'  
TERM   
'xterm-256color'  
TERM\_PROGRAM   
'iTerm.app'  
TERM\_PROGRAM\_VERSION   
'3.0.15'  
TERM\_SESSION\_ID   
'w0t0p0:A9F167CF-61B6-4F36-9B22-97FD86E90A95'  
TMPDIR   
'/var/folders/t5/v0wqfn8s1qx79j05tzv117d00000gn/T/'  
TZ   
'US/Pacific'  
USER   
'jeffchen'  
VIRTUAL\_ENV   
'/Users/jeffchen/PycharmProjects/jeffchenseo/jeffchenseo\_env'  
WHITE   
'\x1b[38;5;244m'  
XPC\_FLAGS   
'0x0'  
XPC\_SERVICE\_NAME   
'0'  
\_   
'/usr/local/bin/python3'  
\_\_CF\_USER\_TEXT\_ENCODING   
'0x1F5:0:0'  
**PYVENV\_LAUNCHER**  
'/usr/local/Cellar/python3/3.6.2/bin/python3.6'  
\_system\_arch   
'x86\_64'  
\_system\_name   
'OSX'  
\_system\_type   
'Darwin'  
\_system\_version   
'10.12'  
rvm\_bin\_path   
'/Users/jeffchen/.rvm/bin'  
rvm\_path   
'/Users/jeffchen/.rvm'  
rvm\_prefix   
'/Users/jeffchen'  
rvm\_version   
'1.29.1 (latest)'  
wsgi.errors   
\<\_io.TextIOWrapper name='' mode='w' encoding='UTF-8'\>  
wsgi.file\_wrapper   
''  
wsgi.input   
\<\_io.BufferedReader name=7\>  
wsgi.multiprocess   
False  
wsgi.multithread   
True  
wsgi.run\_once   
False  
wsgi.url\_scheme   
'http'  
wsgi.version   
(1, 0)

---

<div class="post-metadata">

**Author:** ![thejeffchen](https://avatars.discourse-cdn.com/v4/letter/t/958977/32.png) [@thejeffchen](https://discuss.elastic.co/u/thejeffchen)\
**Post date:** [October 24, 2017, 3:23am UTC](https://discuss.elastic.co/t/help-with-elasticsearch-dsl-multimatch-not-working-with-searching-through-text-and-integer-doc-types-transport-error-400/104857/4 "2017-10-24T03:23:33Z")

</div>

Let me know if this works / if this is what you were looking for! The http request seems to be not well formatted, I just grabbed it from the django request info

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [October 24, 2017, 10:10am UTC](https://discuss.elastic.co/t/help-with-elasticsearch-dsl-multimatch-not-working-with-searching-through-text-and-integer-doc-types-transport-error-400/104857/5 "2017-10-24T10:10:45Z")

</div>

sorry, this is not what I was looking for, you dumped the environment and a stack trace from your application. I was more interested in the elasticsearch side of exceptions and the full request/response from your application.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [November 21, 2017, 10:10am UTC](https://discuss.elastic.co/t/help-with-elasticsearch-dsl-multimatch-not-working-with-searching-through-text-and-integer-doc-types-transport-error-400/104857/6 "2017-11-21T10:10:53Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
