Created
June 9, 2011 15:02
-
-
Save clintongormley/1016898 to your computer and use it in GitHub Desktop.
span_first query example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# [Thu Jun 9 17:00:23 2011] Protocol: http, Server: 192.168.5.103:9200 | |
curl -XPUT 'http://127.0.0.1:9200/test/?pretty=1' | |
# [Thu Jun 9 17:00:23 2011] Response: | |
# { | |
# "ok" : true, | |
# "acknowledged" : true | |
# } | |
# [Thu Jun 9 17:00:31 2011] Protocol: http, Server: 192.168.5.103:9200 | |
curl -XPOST 'http://127.0.0.1:9200/test/foo?pretty=1' -d ' | |
{ | |
"text" : "joe bloggs" | |
} | |
' | |
# [Thu Jun 9 17:00:31 2011] Response: | |
# { | |
# "ok" : true, | |
# "_index" : "test", | |
# "_id" : "sHGiBy_MS1aPulbsWOasUw", | |
# "_type" : "foo", | |
# "_version" : 1 | |
# } | |
# [Thu Jun 9 17:00:43 2011] Protocol: http, Server: 192.168.5.103:9200 | |
curl -XPOST 'http://127.0.0.1:9200/test/foo?pretty=1' -d ' | |
{ | |
"text" : "bloggs joe" | |
} | |
' | |
# [Thu Jun 9 17:00:43 2011] Response: | |
# { | |
# "ok" : true, | |
# "_index" : "test", | |
# "_id" : "AsGSQyyaSISTM2py5-zmfw", | |
# "_type" : "foo", | |
# "_version" : 1 | |
# } | |
# [Thu Jun 9 17:01:05 2011] Protocol: http, Server: 192.168.5.103:9200 | |
curl -XGET 'http://127.0.0.1:9200/_all/_search?pretty=1' -d ' | |
{ | |
"query" : { | |
"span_first" : { | |
"match" : { | |
"span_term" : { | |
"text" : "bloggs" | |
} | |
}, | |
"end" : 1 | |
} | |
} | |
} | |
' | |
# [Thu Jun 9 17:01:05 2011] Response: | |
# { | |
# "hits" : { | |
# "hits" : [ | |
# { | |
# "_source" : { | |
# "text" : "bloggs joe" | |
# }, | |
# "_score" : 0.13561106, | |
# "_index" : "test", | |
# "_id" : "AsGSQyyaSISTM2py5-zmfw", | |
# "_type" : "foo" | |
# } | |
# ], | |
# "max_score" : 0.13561106, | |
# "total" : 1 | |
# }, | |
# "timed_out" : false, | |
# "_shards" : { | |
# "failed" : 0, | |
# "successful" : 29, | |
# "total" : 29 | |
# }, | |
# "took" : 8 | |
# } | |
# [Thu Jun 9 17:01:08 2011] Protocol: http, Server: 192.168.5.103:9200 | |
curl -XGET 'http://127.0.0.1:9200/_all/_search?pretty=1' -d ' | |
{ | |
"query" : { | |
"span_first" : { | |
"match" : { | |
"span_term" : { | |
"text" : "bloggs" | |
} | |
}, | |
"end" : 2 | |
} | |
} | |
} | |
' | |
# [Thu Jun 9 17:01:08 2011] Response: | |
# { | |
# "hits" : { | |
# "hits" : [ | |
# { | |
# "_source" : { | |
# "text" : "bloggs joe" | |
# }, | |
# "_score" : 0.13561106, | |
# "_index" : "test", | |
# "_id" : "AsGSQyyaSISTM2py5-zmfw", | |
# "_type" : "foo" | |
# }, | |
# { | |
# "_source" : { | |
# "text" : "joe bloggs" | |
# }, | |
# "_score" : 0.13561106, | |
# "_index" : "test", | |
# "_id" : "sHGiBy_MS1aPulbsWOasUw", | |
# "_type" : "foo" | |
# } | |
# ], | |
# "max_score" : 0.13561106, | |
# "total" : 2 | |
# }, | |
# "timed_out" : false, | |
# "_shards" : { | |
# "failed" : 0, | |
# "successful" : 29, | |
# "total" : 29 | |
# }, | |
# "took" : 5 | |
# } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment