# Search for Users / E-Mail Add returns Empty json on existing Tickets

**URL:** <https://community.zammad.org/t/search-for-users-e-mail-add-returns-empty-json-on-existing-tickets/4133>\
**Category:** Technical assistance\
**Created:** [March 2, 2020, 4:56pm UTC](https://community.zammad.org/t/search-for-users-e-mail-add-returns-empty-json-on-existing-tickets/4133 "2020-03-02T16:56:41Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![gorg3b](https://community.zammad.org/user_avatar/community.zammad.org/gorg3b/32/2535_2.png) [@gorg3b](https://community.zammad.org/u/gorg3b)\
**Post date:** [March 2, 2020, 4:56pm UTC](https://community.zammad.org/t/search-for-users-e-mail-add-returns-empty-json-on-existing-tickets/4133/1 "2020-03-02T16:56:41Z")

</div>

Searching for Existing E-Mail / Users when adding Cc or To E-Mail Fields with existing Tickets

- Used Zammad version: 3.2.x
- Installation method (source, package, …): package
- Operating system: Ubuntu 16.04
- Database + version: postgresql 9.5.19
- Elasticsearch version: 5.6.16
- Browser + version: 73.0.1

### Actual behavior:

Search over URL Triggers Network Traffic / API Call

[https://zammad/api/v1/users/search?term=flor](https://zammad/api/v1/users/search?term=flor)

with an Empty Response. -\> []

The User I did search for does Exists.

### Expected behavior:

Searching within a new Ticket creates a different API Call eg.

[https://zammad/api/v1/search/user-organization?query=flor&\_=](https://zammad/api/v1/search/user-organization?query=flor&_=)

which returns a json with resprective users / organizations

### Steps to reproduce the behavior:

Change the To or Cc E-Mail Address on an existing Ticket.

---

<div class="post-metadata">

**Author:** ![MrGeneration](https://community.zammad.org/user_avatar/community.zammad.org/mrgeneration/32/9260_2.png) [@MrGeneration](https://community.zammad.org/u/MrGeneration)\
**Post date:** [March 3, 2020, 4:47pm UTC](https://community.zammad.org/t/search-for-users-e-mail-add-returns-empty-json-on-existing-tickets/4133/2 "2020-03-03T16:47:31Z")

</div>

Welcome to the Community,

> [@gorg3b](#):
>
> [https://zammad/api/v1/users/search?term=flor](https://zammad/api/v1/users/search?term=flor)

Zammad expects you to provide the parameter `query` - you used `term` which should be your issue here. 🙂  
At least that’s what our docs say: `GET /api/v1/users/search?query=what&limit=10 `

I hope this helps.

Best regards

---

<div class="post-metadata">

**Author:** ![gorg3b](https://community.zammad.org/user_avatar/community.zammad.org/gorg3b/32/2535_2.png) [@gorg3b](https://community.zammad.org/u/gorg3b)\
**Post date:** [March 3, 2020, 5:31pm UTC](https://community.zammad.org/t/search-for-users-e-mail-add-returns-empty-json-on-existing-tickets/4133/3 "2020-03-03T17:31:24Z")

</div>

Hi,

sorry i should have been clearer, the problem occurs when using the UI. Eg Using the Interface open an existing Ticket -\> Reply to the Ticket and trying to change either to or cc address

BTW: Thanks for the greate Product!

Regards

Georg

---

<div class="post-metadata">

**Author:** ![MrGeneration](https://community.zammad.org/user_avatar/community.zammad.org/mrgeneration/32/9260_2.png) [@MrGeneration](https://community.zammad.org/u/MrGeneration)\
**Post date:** [March 4, 2020, 5:28pm UTC](https://community.zammad.org/t/search-for-users-e-mail-add-returns-empty-json-on-existing-tickets/4133/4 "2020-03-04T17:28:24Z")

</div>

Can you find the affected user within the quick search on the upper left?  
If so, click into the e.g. CC field, type at least 3 letters and wait a moment.

Zammad should find exactly the same user(s).

If you can’t find the user in the search bar already, please rebuild your searchindex, because it’s proberbly broken then.

If that still doesn’t work, please ensure your Zammad is running without any modifications and provide log files.

---

<div class="post-metadata">

**Author:** ![saz](https://community.zammad.org/user_avatar/community.zammad.org/saz/32/2557_2.png) [@saz](https://community.zammad.org/u/saz)\
**Post date:** [March 5, 2020, 9:26am UTC](https://community.zammad.org/t/search-for-users-e-mail-add-returns-empty-json-on-existing-tickets/4133/5 "2020-03-05T09:26:55Z")

</div>

@MrGeneration You’re seeing the same API endpoints used by the frontend as reported in the initial message and both are returning a result?

Using the quick search field I’m able to find something.  
While searching for a contact on a new issue zammad frontend is using the (as far as I can see - undocumented) api endpoint `/search/user-organization` while it’s using `/users/search` for an existing issue.

Why is the frontend using different endpoints for doing the same thing?  
What’s the difference between those two endpoints? Is one using e.g. elasticsearch and the other isn’t?

Thanks!

---

<div class="post-metadata">

**Author:** ![saz](https://community.zammad.org/user_avatar/community.zammad.org/saz/32/2557_2.png) [@saz](https://community.zammad.org/u/saz)\
**Post date:** [March 5, 2020, 9:32am UTC](https://community.zammad.org/t/search-for-users-e-mail-add-returns-empty-json-on-existing-tickets/4133/6 "2020-03-05T09:32:41Z")

</div>

The quick search field is using the `/search` api endpoint. That’s another endpoint. 2 out of 3 giving a result 🙂

---

<div class="post-metadata">

**Author:** ![saz](https://community.zammad.org/user_avatar/community.zammad.org/saz/32/2557_2.png) [@saz](https://community.zammad.org/u/saz)\
**Post date:** [March 5, 2020, 9:46am UTC](https://community.zammad.org/t/search-for-users-e-mail-add-returns-empty-json-on-existing-tickets/4133/7 "2020-03-05T09:46:33Z")

</div>

From the logs:

> 2020-03-05T10:44:03.273516+01:00 zammad1 zammad[3928]: Unable to process GET request to elasticsearch URL ‘[http://zammad-es1:9200/zammad\_production/User/\_search](http://zammad-es1:9200/zammad_production/User/_search)’. Check the response and payload for detailed information: #012#012Response:#012#\<UserAgent::Result:0x00007f5c48f1ae68 @success=false, @body=“{"error":{"root\_cause":[{"type":"query\_shard\_exception","reason":"No mapping found for [active.keyword] in order to sort on","index\_uuid":"ag5xi7SwTtK7tJkPYrh4aw","index":"zammad\_production"}],"type":"search\_phase\_execution\_exception","reason":"all shards failed","phase":"query","grouped":true,"failed\_shards":[{"shard":0,"index":"zammad\_production","node":"6bKIjGnLQgSq\_hcNHrL0aQ","reason":{"type":"query\_shard\_exception","reason":"No mapping found for [active.keyword] in order to sort on","index\_uuid":"ag5xi7SwTtK7tJkPYrh4aw","index":"zammad\_production"}}]},"status":400}”, @data=nil, @code=“400”, @content\_type=nil, @error=“Client Error: #\<Net::HTTPBadRequest 400 Bad Request readbody=true\>!”\>#012#012Payload:#012{:from=\>0, :size=\>100, :sort=\>[{“active.keyword”=\>{:order=\>“desc”}}, {“updated\_at”=\>{:order=\>“desc”}}, “\_score”], :query=\>{:bool=\>{:must=\>[{“query\_string”=\>{“query”=\>“steffen\*”, “default\_operator”=\>“AND”, “analyze\_wildcard”=\>true}}]}}}#012#012Payload size: 0M

---

<div class="post-metadata">

**Author:** ![gorg3b](https://community.zammad.org/user_avatar/community.zammad.org/gorg3b/32/2535_2.png) [@gorg3b](https://community.zammad.org/u/gorg3b)\
**Post date:** [March 5, 2020, 12:26pm UTC](https://community.zammad.org/t/search-for-users-e-mail-add-returns-empty-json-on-existing-tickets/4133/8 "2020-03-05T12:26:46Z")

</div>

Hi,

.) I was able to find the User on searchbar  
.) Still did rebuild the searchindex  
but that did not fix the issue still.  
I did also Update to 3.3 and another reindex after which the Problem was solved.

Thanks for the fast help1

Georg

---

<div class="post-metadata">

**Author:** ![MrGeneration](https://community.zammad.org/user_avatar/community.zammad.org/mrgeneration/32/9260_2.png) [@MrGeneration](https://community.zammad.org/u/MrGeneration)\
**Post date:** [March 9, 2020, 10:50am UTC](https://community.zammad.org/t/search-for-users-e-mail-add-returns-empty-json-on-existing-tickets/4133/9 "2020-03-09T10:50:38Z")

</div>

> [@saz](#):
>
> [{“type”:“query\_shard\_exception”,“reason”:“No mapping found for [active.keyword] in order to sort

This error appears if your searchindex is broken.  
`zammad run rake searchindex:rebuild` solves this issue.

Note that Updating to either Zammad 3.2 and 3.3 is requiring a reindex of your system.

---

<div class="post-metadata">

**Author:** ![system](https://community.zammad.org/uploads/default/original/1X/5c5afaea2d23f811dbec33cd4edb02fa29d3262f.png) [@system](https://community.zammad.org/u/system)\
**Post date:** [July 7, 2020, 10:50am UTC](https://community.zammad.org/t/search-for-users-e-mail-add-returns-empty-json-on-existing-tickets/4133/10 "2020-07-07T10:50:44Z")

</div>

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