1

My index was created in C#:

CreateIndexRequest request = new CreateIndexRequest(index.ToString().ToLower());
TypeMapping typeMapping = new TypeMapping();
typeMapping.DateDetection = false;
request.Mappings = new Mappings();
request.Mappings.Add("object", typeMapping);
esConfig.CreateIndex(request);

Here's the after the fact definition of a field i'm trying to query called 'traceText":

      "traceText": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignore_above": 256
          }
        }
      },

When I do this search, I'm not getting any hits:

GET /local-tlrgloadtenderout-2018.06.04/_search
{"query": {
     "term" : {"traceText":"Global-Catch-Error"}
}}

similar with something simpler on a similar field:

GET /local-tlrgloadtenderout-2018.06.04/_search
{"query": {
     "term" : {"traceLevel":"E"}
}}

When I use Kibana, I can specify:

  traceText:'Global-Catch-Error'

or

  traceLevel: 'E' 

and everything works perfectly.

What do I need to do to get the Elastic Search query to work? I'm using Version 6.0.0.

NealWalters
  • 17,197
  • 42
  • 141
  • 251

1 Answers1

0

I tried changing "term" to "match" and it worked. See explanation in this StackOverflow question: elasticsearch match vs term query

NealWalters
  • 17,197
  • 42
  • 141
  • 251