1

Here are my mappings for index metadata

{
    "mappings": {
        "metric": {
            "properties": {
                'model_id': {"type": "string", "index": "not_analyzed"}
            }
        }
    }
 }

I can see that I have 1 document in Kibana under that index enter image description here

Here is my query as a curl command:

curl -XGET 'localhost:9200/metadata/metric/_search?pretty' -H 'Content-Type: application/json' -d'
{
    "query" : {
        "constant_score" : {
            "filter" : {
                "term" : {
                    "model_id" : "2532070e-da4b-465f-ba3b-f96beaaa6d5c"
                }
            }
        }
    }
}
'

Here is what it returns:

{
  "took" : 0,
  "timed_out" : false,
  "_shards" : {
    "total" : 5,
    "successful" : 5,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : 0,
    "max_score" : null,
    "hits" : [ ]
  }
}

I followed the directions in the documentation here to try and get this working:

https://www.elastic.co/guide/en/elasticsearch/guide/current/_finding_exact_values.html

3 Answers 3

1

Because you're not querying the right type, you query metrics instead of metric, this should get you what you want:

curl -XGET 'localhost:9200/metadata/metric/_search?pretty' -H 'Content-Type: application/json' -d'
                                         ^
                                         |
                                   remove s here
Sign up to request clarification or add additional context in comments.

2 Comments

I had actually setup my index incorrectly. You are correct here, but it was just a typo in my stackoverflow post. I went back and confirmed I was using metric
Gotcha, glad you figured it out
0

Make sure your index is setup correctly.

1 Comment

You should probably explain a bit more what you had wrong if you want your answer to be helpful to people :-)
0

I'm using ES 5.6.2 , try this mapping

"mappings":{
  "metric":{
     "properties":{
        "model_id":{
           "type":"string",
           "index":"not_analyzed",
           "fields":{
              "keyword":{
                 "type":"keyword",
                 "ignore_above":256
              }
           }
        }
    }
}

}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.