# Why can't I get the result?

**URL:** <https://discuss.elastic.co/t/why-cant-i-get-the-result/240910>\
**Category:** Elasticsearch\
**Created:** [July 13, 2020, 7:27am UTC](https://discuss.elastic.co/t/why-cant-i-get-the-result/240910 "2020-07-13T07:27:23Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![wajika](https://avatars.discourse-cdn.com/v4/letter/w/977dab/32.png) [@wajika](https://discuss.elastic.co/u/wajika)\
**Post date:** [July 13, 2020, 7:27am UTC](https://discuss.elastic.co/t/why-cant-i-get-the-result/240910/1 "2020-07-13T07:27:24Z")

</div>

> ```
> GET abp_schedulerlogs_dev/_search
> {
> "query": {
> "bool": {
> "must": {
> "term":{
> "JobInfoId":"08d814f9-470e-4082-8333-6d6de194863e"
> }
> },
> "filter": {
> "term": {
> "SourceType":"workingjob"
> }
> }
> }
> },
> "size": 100
> }
> 
> ```

index has this record

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/7/8/7871a9d781877d8b4efb0727dc8212e2871570c2.png)

index mapping

> ```
> {
> "mapping": {
> "properties": {
> "@timestamp": {
> "type": "date"
> },
> "@version": {
> "type": "text",
> "fields": {
> "keyword": {
> "type": "keyword",
> "ignore_above": 256
> }
> }
> },
> "BrowserInfo": {
> "type": "text",
> "fields": {
> "keyword": {
> "type": "keyword",
> "ignore_above": 256
> }
> }
> },
> "Category": {
> "type": "long"
> },
> "ClientIpAddress": {
> "type": "text",
> "fields": {
> "keyword": {
> "type": "keyword",
> "ignore_above": 256
> }
> }
> },
> "CreateTime": {
> "type": "date"
> },
> "DomainName": {
> "type": "text",
> "fields": {
> "keyword": {
> "type": "keyword",
> "ignore_above": 256
> }
> }
> },
> "Exception": {
> "type": "text",
> "fields": {
> "keyword": {
> "type": "keyword",
> "ignore_above": 256
> }
> }
> },
> "ExecutionDuration": {
> "type": "long"
> },
> "ExecutionTime": {
> "type": "date"
> },
> "Id": {
> "type": "text",
> "fields": {
> "keyword": {
> "type": "keyword",
> "ignore_above": 256
> }
> }
> },
> "ImpersonatorTenantId": {
> "type": "long"
> },
> "JobInfoId": {
> "type": "text",
> "fields": {
> "keyword": {
> "type": "keyword",
> "ignore_above": 256
> }
> }
> },
> "JobName": {
> "type": "text",
> "fields": {
> "keyword": {
> "type": "keyword",
> "ignore_above": 256
> }
> }
> },
> "Message": {
> "type": "text",
> "fields": {
> "keyword": {
> "type": "keyword",
> "ignore_above": 256
> }
> }
> },
> "MethodName": {
> "type": "text",
> "fields": {
> "keyword": {
> "type": "keyword",
> "ignore_above": 256
> }
> }
> },
> "Name": {
> "type": "text",
> "fields": {
> "keyword": {
> "type": "keyword",
> "ignore_above": 256
> }
> }
> },
> "Parameters": {
> "type": "text",
> "fields": {
> "keyword": {
> "type": "keyword",
> "ignore_above": 256
> }
> }
> },
> "ServiceName": {
> "type": "text",
> "fields": {
> "keyword": {
> "type": "keyword",
> "ignore_above": 256
> }
> }
> },
> "SourceType": {
> "type": "text",
> "fields": {
> "keyword": {
> "type": "keyword",
> "ignore_above": 256
> }
> }
> },
> "TenantId": {
> "type": "long"
> },
> "UserId": {
> "type": "text",
> "fields": {
> "keyword": {
> "type": "keyword",
> "ignore_above": 256
> }
> }
> }
> }
> }
> }
> 
> ```

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [July 13, 2020, 7:29am UTC](https://discuss.elastic.co/t/why-cant-i-get-the-result/240910/2 "2020-07-13T07:29:08Z")

</div>

You need to query the keyword subfield, e.g. ‘Id.keyword’.

---

<div class="post-metadata">

**Author:** ![wajika](https://avatars.discourse-cdn.com/v4/letter/w/977dab/32.png) [@wajika](https://discuss.elastic.co/u/wajika)\
**Post date:** [July 13, 2020, 8:57am UTC](https://discuss.elastic.co/t/why-cant-i-get-the-result/240910/3 "2020-07-13T08:57:57Z")

</div>

> [@wajika](#):
>
> ```auto
> GET abp_schedulerlogs_dev/_search
> {
> "query": {
> "bool": {
> "must": {
> "term":{
> "JobInfoId":"08d814f9-470e-4082-8333-6d6de194863e"
> }
> },
> "filter": {
> "term": {
> "SourceType":"workingjob"
> }
> }
> }
> },
> "size": 100
> }
> 
> ```

Why is this? @Christian_Dahlqvist

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [July 13, 2020, 9:08am UTC](https://discuss.elastic.co/t/why-cant-i-get-the-result/240910/4 "2020-07-13T09:08:11Z")

</div>

You need to use the keyword subfield due to how your field is mapped in Elasticsearch.

---

<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:** [August 10, 2020, 9:08am UTC](https://discuss.elastic.co/t/why-cant-i-get-the-result/240910/5 "2020-08-10T09:08:16Z")

</div>

Closed on August 10, 2020, 9:08am UTC

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