Why can't I get the result?

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

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
          }
        }
      }
    }
  }
}

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

1 Like

Why is this? @Christian_Dahlqvist

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

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