Skip to content

Instantly share code, notes, and snippets.

@hshankar
Created July 2, 2011 20:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hshankar/1061603 to your computer and use it in GitHub Desktop.
Save hshankar/1061603 to your computer and use it in GitHub Desktop.
The date query returns no hits but the Impressions query works
curl -XPUT 'http://localhost:9200/test1' -d '{
"mappings" : {
"entity" : {
"properties" : {
"Headline" : {
"type" : "string", "index" : "not_analyzed"
},
"Line1" : {
"type" : "string", "index" : "not_analyzed"
},
"TCID" : {
"type" : "integer"
},
"NwAccountID" : {
"type" : "integer"
}
}
},
"fact" : {
"_parent" : {
"type" : "entity"
},
"_routing" : {
"required" : "false"
},
"properties" : {
"TCID" : {
"type" : "integer"
},
"NwAccountID" : {
"type" : "integer"
},
"Date" : {
"type" : "date", "format" : "YYYYMMdd"
},
"Conversions" : {
"type" : "integer"
},
"Impressions" : {
"type" : "integer"
}
}
}
}
}'
curl -XPUT 'http://localhost:9200/test1/entity/2331_34221' -d '{
"Headline" : "Black shoes",
"Line1" : "Awesome shoes",
"TCID" : 34221,
"NwAccountID" : 2331
}'
curl -XPUT 'http://localhost:9200/test1/entity/2331_34225' -d '{
"Headline" : "Red shoes",
"Line1" : "Awesome shoes",
"TCID" : 34225,
"NwAccountID" : 2331
}'
curl -XPUT 'http://localhost:9200/test1/entity/2331_34223' -d '{
"Headline" : "Red shoes",
"Line1" : "Awesome red shoes",
"TCID" : 34223,
"NwAccountID" : 2331
}'
curl -XPUT 'http://localhost:9200/test1/entity/2331_34442' -d '{
"Headline" : "Black shoes",
"Line1" : "Awesome black shoes",
"TCID" : 34442,
"NwAccountID" : 2331
}'
curl -XPUT 'http://localhost:9200/test1/entity/2330_33421' -d '{
"Headline" : "Red shoes",
"Line1" : "Awesome red shoes",
"TCID" : 33421,
"NwAccountID" : 2330
}'
curl -XPUT 'http://localhost:9200/test1/entity/2331_34427' -d '{
"Headline" : "Black shoes",
"Line1" : "Awesome shoes",
"TCID" : 34427,
"NwAccountID" : 2331
}'
curl -XPUT 'http://localhost:9200/test1/fact/2331_34421_20110601?parent=2331_34221' -d '{
"TCID" : 34221,
"NwAccountID" : 2331,
"Date" : 20110601,
"Conversions" : 2,
"Impressions" : 10
}'
curl -XPUT 'http://localhost:9200/test1/fact/2331_34421_20110602?parent=2331_34221' -d '{
"TCID" : 34221,
"NwAccountID" : 2331,
"Date" : 20110602,
"Conversions" : 3,
"Impressions" : 5
}'
curl -XPUT 'http://localhost:9200/test1/fact/2331_34421_20110603?parent=2331_34221' -d '{
"TCID" : 34221,
"NwAccountID" : 2331,
"Date" : 20110603,
"Conversions" : 1,
"Impressions" : 4
}'
curl -XPUT 'http://localhost:9200/test1/fact/2331_34421_20110605?parent=2331_34221' -d '{
"TCID" : 34221,
"NwAccountID" : 2331,
"Date" : 20110605,
"Conversions" : 5,
"Impressions" : 7
}'
curl -XPUT 'http://localhost:9200/test1/fact/2331_34425_20110602?parent=2331_34225' -d '{
"TCID" : 34225,
"NwAccountID" : 2331,
"Date" : 20110602,
"Conversions" : 3,
"Impressions" : 11
}'
curl -XPUT 'http://localhost:9200/test1/fact/2331_34425_20110603?parent=2331_34225' -d '{
"TCID" : 34225,
"NwAccountID" : 2331,
"Date" : 20110604,
"Conversions" : 6,
"Impressions" : 9
}'
curl -XPUT 'http://localhost:9200/test1/fact/2331_34223_20110604?parent=2331_34223' -d '{
"TCID" : 34223,
"NwAccountID" : 2331,
"Date" : 20110604,
"Conversions" : 3,
"Impressions" : 5
}'
curl -XPUT 'http://localhost:9200/test1/fact/2331_34223_20110605?parent=2331_34223' -d '{
"TCID" : 34223,
"NwAccountID" : 2331,
"Date" : 20110605,
"Conversions" : 4,
"Impressions" : 9
}'
curl -XPUT 'http://localhost:9200/test1/fact/2331_34223_20110606?parent=2331_34223' -d '{
"TCID" : 34223,
"NwAccountID" : 2331,
"Date" : 20110606,
"Conversions" : 2,
"Impressions" : 3
}'
curl -XPUT 'http://localhost:9200/test1/fact/2331_34442_20110601?parent=2331_34442' -d '{
"TCID" : 34442,
"NwAccountID" : 2331,
"Date" : 20110601,
"Conversions" : 1,
"Impressions" : 7
}'
curl -XPUT 'http://localhost:9200/test1/fact/2331_34442_20110602?parent=2331_34442' -d '{
"TCID" : 34442,
"NwAccountID" : 2331,
"Date" : 20110602,
"Conversions" : 3,
"Impressions" : 4
}'
curl -XPUT 'http://localhost:9200/test1/fact/2331_34442_20110605?parent=2331_34442' -d '{
"TCID" : 34442,
"NwAccountID" : 2331,
"Date" : 20110605,
"Conversions" : 4,
"Impressions" : 7
}'
curl -XPUT 'http://localhost:9200/test1/fact/2330_34421_20110604?parent=2330_34421' -d '{
"TCID" : 34421,
"NwAccountID" : 2330,
"Date" : 20110604,
"Conversions" : 9,
"Impressions" : 10
}'
curl -XPUT 'http://localhost:9200/test1/fact/2330_34421_20110606?parent=2330_34421' -d '{
"TCID" : 34421,
"NwAccountID" : 2330,
"Date" : 20110606,
"Conversions" : 4,
"Impressions" : 5
}'
curl -XPUT 'http://localhost:9200/test1/fact/2331_34427_20110603?parent=2331_34427' -d '{
"TCID" : 34427,
"NwAccountID" : 2331,
"Date" : 20110603,
"Conversions" : 4,
"Impressions" : 9
}'
curl -XPUT 'http://localhost:9200/test1/fact/2331_34427_20110605?parent=2331_34427' -d '{
"TCID" : 34427,
"NwAccountID" : 2331,
"Date" : 20110605,
"Conversions" : 5,
"Impressions" : 11
}'
curl 'http://localhost:9200/test1/fact/_search?pretty=true' -d '{
"filter" : {
"term" : {
"Date" : 20110603
}
}
}'
{
"took" : 6,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" : [ ]
}
}
curl 'http://localhost:9200/test1/fact/_search?pretty=true' -d '{
"filter" : {
"term" : {
"Impressions" : 4
}
}
}'
{
"took" : 14,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 2,
"max_score" : 1.0,
"hits" : [ {
"_index" : "test1",
"_type" : "fact",
"_id" : "2331_34421_20110603",
"_score" : 1.0, "_source" : {
"TCID" : 34221,
"NwAccountID" : 2331,
"Date" : 20110603,
"Conversions" : 1,
"Impressions" : 4
}
}, {
"_index" : "test1",
"_type" : "fact",
"_id" : "2331_34442_20110602",
"_score" : 1.0, "_source" : {
"TCID" : 34442,
"NwAccountID" : 2331,
"Date" : 20110602,
"Conversions" : 3,
"Impressions" : 4
}
} ]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment