Created
June 5, 2013 07:03
-
-
Save ramseykhalaf/5712106 to your computer and use it in GitHub Desktop.
An example of a confusing mapping in elasticsearch.
This file contains 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
curl -XDELETE http://localhost:27000/sandbox | |
curl -XPUT http://localhost:27000/sandbox -d '{ | |
}' | |
curl -XPUT http://localhost:27000/sandbox/websites/_mapping -d '{ | |
"websites" : { | |
"properties" : { | |
"tags" : { | |
"type" : "string" | |
}, | |
"url": { | |
"type": "string", | |
"index": "no", | |
"include_in_all": "true" | |
} | |
} | |
} | |
}' | |
curl -XPUT http://localhost:27000/sandbox/websites/1?refresh=1 -d '{ | |
"text": "sample text computer", | |
"url": "www.domain.com" | |
}' | |
curl -XGET http://localhost:27000/sandbox/_search | |
curl -XGET http://localhost:27000/sandbox/websites/_search -d '{ | |
"query": { | |
"term": { | |
"_all": "www.domain.com" | |
} | |
} | |
}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This will give a hit, the
"include_in_all"
means the string is run through the_all
analyzer, which would be the standard one, unless you specify otherwise.