0

i have some documents in elasticsearch that i need to query. here is my mapping

{
   "mappings": {
    "Daily": {
        "properties": {
           "campaignID":{
             "type":"long"
           }, 
           "accountID":{
             "type":"long"
           }
      }
    }
  }
}

here is one of my doc:

 {
"Website Registrations Completed": 0,
"3-Second Video Views": 0,
"Photo Views": 0,
"Website Adds to Wishlist": 0,
"Objective": "CONVERSIONS",
"Website Checkouts Initiated": 0,
"Clicks": 1091,
"Social Impressions": 36502,
"campaignID": 31842593123459132,
"Reach": 69745,
"Website Searches": 0,
"Website Leads": 0,
"Website Adds to Cart": 6,
"accountID": 9837295319561761,
"Page Likes": 72,
"Cpm": 46.657440197555,
"Ctr": 1.4803055589476002
 }

and here is my query:

{
  "query": {
    "bool": {
      "must": [
        {
          "term": {
            "accountID": "9837295319561761"
          }
        }
      ]
    }
  }
}

this should work as but it gives empty output???why is this happening.( i know i can just use a term query directly for the above query but this was actually a part of bigger query).

i tried with with this:

{
  "query": {
    "term": {
      "accountID": "1007295319405768"
    }
  }
}
anekix
  • 2,393
  • 2
  • 30
  • 57
  • your account_id value is wrong in query – user3775217 Jun 10 '17 at 14:06
  • @user3775217 i made a mistake here while changing the original id's. but in my query i am using coorect id – anekix Jun 10 '17 at 14:08
  • Can you get result for any other accountID? what about a `match_all` query? – Mohammad Mazraeh Jun 10 '17 at 14:23
  • 1
    This answer might help: https://stackoverflow.com/questions/38952262/elasticsearch-max-length-of-mapping-type-long/38952540#38952540 The solution is to store your `accountID` field as a keyword instead of long – Val Jun 11 '17 at 03:55
  • @Val thanks a lot that was indeed the problem i indexed those as string and it works . many thanks :) – anekix Jun 11 '17 at 05:35

0 Answers0