hi,
yes, with only "http" it works fine but with "http*:*" it fails
in the end i want to search for uri parts, but it don't accept the : in uris
Am 23.09.2013 23:25, schrieb Luca Cavanna:
Hi,
did you make sure you never get back errors from elasticsearch? I just
tried the following, without even submitting a custom mapping (using
the default one) and it worked fine:
curl -XPUT localhost:9200/test/test/1 -d '{
"uri":"http://abc.xyz/abc"
}
'
curl -XPOST localhost:9200/test/test/_search -d '{
"query": {
"constant_score": {
"filter": {
"prefix": {
"uri": "http"
}
}
}
}
}
'
I had to slightly modify your curl requests though. The documents
contained unquoted field names and the constant score query contained
a filter array, which is not supposed to be an array but a single object.
The above query returns the document that I previously indexed.
Cheers
Luca
On Monday, September 23, 2013 3:43:55 PM UTC+2, Andreas Jaekle wrote:
hi,
i tried it, but it is not working.
this is my test script:
IP=127.0.0.1
curl -XPUT "$IP:9200/test" -d '{
"mappings": {
"sample":{
"properties" : {
"uri" : {
"type": "string",
"index": "not_analyzed"
}
}
}
}
}'
echo ""
echo "------------------------------------------------"
curl -XPOST "http://$IP:9200/test/test/1" --data
'{uri:"http://abc.def/abc",value:"abc"}'
echo ""
curl -XPOST "http://$IP:9200/test/test/2" --data
'{uri:"http://abc.xyz/abc",value:"def"}'
echo ""
curl -XPOST "http://$IP:9200/test/test/3" --data
'{uri:"http://abc.ijk/abc",value:"ijk"}'
sleep 2
echo ""
echo "------------------------------------------------ simple prefix
search:"
curl "http://$IP:9200/test/_search?pretty=true" --data
'{"query":{"constant_score":{"filter":[{"prefix":{"uri":"http"}}]}},"from":0,"size":10,"sort":[],"facets":{}}'
echo ""
echo "------------------------------------------------ search (not
working):"
curl "http://$IP:9200/test/_search?pretty=true" --data
'{"query":{"constant_score":{"filter":[{"prefix":{"uri":"http:"}}]}},"from":0,"size":10,"sort":[],"facets":{}}'
echo ""
echo "------------------------------------------------ all"
curl "http://$IP:9200/test/_search?pretty=true"
echo ""
echo "------------------------------------------------ mapping"
curl "http://$IP:9200/_mapping?pretty=true"
Am 20.09.2013 18:24, schrieb Jun Ohtani:
> Hi Andreas,
>
> Maybe, you use default setting, that analyzer is standard analyzer.
> ':' is not indexed, if you use standard analyzer
>
> Do you run following command?
> It's response how to analyze uri field in ElasticSearch.
>
> curl -XPOST
'http://localhost:9200/url_test/_analyze?pretty=true&field=uri
<http://localhost:9200/url_test/_analyze?pretty=true&field=uri>'
--data 'http://abc.xyz/abc'
>
> Probably, you get the following response.
>
> {
> "tokens" : [ {
> "token" : "http",
> "start_offset" : 0,
> "end_offset" : 4,
> "type" : "<ALPHANUM>",
> "position" : 1
> }, {
> "token" : "abc.xyz",
> "start_offset" : 7,
> "end_offset" : 14,
> "type" : "<ALPHANUM>",
> "position" : 2
> }, {
> "token" : "abc",
> "start_offset" : 15,
> "end_offset" : 18,
> "type" : "<ALPHANUM>",
> "position" : 3
> } ]
> }
>
> If you do not want analyze uri field, you use following mappings
to create index.
>
> curl -XPUT 'localhost:9200/url_test' -d '{
> "mappings": {
> "sample":{
> "properties" : {
> "uri" : {
> "type": "string",
> "index": "not_analyzed"
> }
> }
> }
> }
> }'
>
>
> Regards
>
> ------------
> Jun Ohtani
> joh...@gmail.com <javascript:>
> blog(japanese) : http://blog.johtani.info
> twitter : http://twitter.com/johtani
>
>
>
>
> On 2013/09/20, at 19:24, Andreas Jaekle <andreas...@gmail.com
<javascript:>> wrote:
>
>> hi,
>> im trying to search for URIs which are on one domain. But the
search always fails at the ":"
>> How can i search for all URIs which start with "http://abc.xyz/"
>>
>> curl -XPOST 'http://localhost:9200/test/test/1
<http://localhost:9200/test/test/1>' --data
'{uri:"http://abc.def/abc"}'
>>
>> curl -XPOST 'http://localhost:9200/test/test/2
<http://localhost:9200/test/test/2>' --data
'{uri:"http://abc.xyz/abc"}'
>>
>> curl -XPOST 'http://localhost:9200/test/test/3
<http://localhost:9200/test/test/3>' --data
'{uri:"http://abc.ijk/abc"}'
>>
>> curl 'http://localhost:9200/test/_search?pretty=true
<http://localhost:9200/test/_search?pretty=true>' --data
'{"query":{"constant_score":{"filter":[{"prefix":{"uri":"http:"}}],"must_not":[],"should":[]}},"from":0,"size":10,"sort":[],"facets":{}}'
>>
>> This query won't work, even if i escape the : with \
>>
>> Any ideas ?
>>
>> --
>> You received this message because you are subscribed to the
Google Groups "elasticsearch" group.
>> To unsubscribe from this group and stop receiving emails from
it, send an email to elasticsearc...@googlegroups.com <javascript:>.
>> For more options, visit
https://groups.google.com/groups/opt_out
<https://groups.google.com/groups/opt_out>.
--
You received this message because you are subscribed to the Google
Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.